Skip to content
On this page

Scale JS / @scale-codec/core

Module: @scale-codec/core

Core SCALE library with tools to encode to and decode SCALE binaries. It includes implementations for primitive types as well as for complex types.

Table of contents

Namespaces

Classes

Interfaces

Type Aliases

Functions

Type Aliases

BigIntTypes

Ƭ BigIntTypes: IntTypes | `${"i" | "u"}${64 | 128 | 256 | 512}`

Set of integer types that are supported by codec for bigint

Defined in

packages/core/src/codecs/int.ts:13


Decode

Ƭ Decode<T>: (walker: Walker) => T

Type parameters

Name
T

Type declaration

▸ (walker): T

Parameters
NameType
walkerWalker
Returns

T

Defined in

packages/core/src/types.ts:1


Encode

Ƭ Encode<T>: Object

Type parameters

Name
T

Call signature

▸ (value, walker): void

Parameters
NameType
valueT
walkerWalker
Returns

void

Type declaration

NameType
sizeHint(value: T) => number

Defined in

packages/core/src/types.ts:3


EnumDecoders

Ƭ EnumDecoders<E>: { [D in number]: { [tag in keyof E]: E[tag] extends [infer C] ? DecodeTuple<tag & string, C> : tag & string }[keyof E] }

Type parameters

NameType
Eextends EnumRecord

Defined in

packages/core/src/codecs/enum.ts:13


EnumEncoders

Ƭ EnumEncoders<E>: { [tag in keyof E]: E[tag] extends [infer C] ? EncodeTuple<C> : number }

Type parameters

NameType
Eextends EnumRecord

Defined in

packages/core/src/codecs/enum.ts:9


EnumOf

Ƭ EnumOf<V>: V extends Variant<infer E, any, any> ? E : never

Type parameters

NameType
Vextends VariantAny

Defined in

packages/enum/src/lib.ts:25


EnumRecord

Ƭ EnumRecord: Record<string, [] | [any]>

Defined in

packages/enum/src/lib.ts:9


Enumerate

Ƭ Enumerate<E>: { [Tag in keyof E]: E[Tag] extends infer Content extends [] | [any] ? Variant<E, Tag & string, Content> : never }[keyof E]

Type parameters

NameType
Eextends EnumRecord

Defined in

packages/enum/src/lib.ts:21


IntTypes

Ƭ IntTypes: `${"i" | "u"}${8 | 16 | 32}`

Set of integer types that are supported by codec for number

Defined in

packages/core/src/codecs/int.ts:8


RustOption

Ƭ RustOption<T>: Enumerate<{ None: [] ; Some: [T] }>

Rust's Option<T> analog

Example

ts
const maybeString: RustOption<string> = variant('None')

Type parameters

Name
T

Defined in

packages/enum/src/lib.ts:83


RustResult

Ƭ RustResult<Ok, Err>: Enumerate<{ Err: [Err] ; Ok: [Ok] }>

Rust's Result<Ok, Err> analog

Example

ts
const file: RustResult<string, Error> = variant('Ok', 'file contents')

Type parameters

Name
Ok
Err

Defined in

packages/enum/src/lib.ts:94


StructDecoders

Ƭ StructDecoders<T>: { [K in keyof T]: [K, Decode<T[K]>] }[keyof T][]

Type parameters

Name
T

Defined in

packages/core/src/codecs/struct.ts:6


StructEncoders

Ƭ StructEncoders<T>: { [K in keyof T]: [K, Encode<T[K]>] }[keyof T][]

Type parameters

Name
T

Defined in

packages/core/src/codecs/struct.ts:4


TupleDecoders

Ƭ TupleDecoders<Tuple>: Tuple extends [infer Head, ...(infer Tail)] ? [Decode<Head>, ...TupleDecoders<Tail>] : []

Type parameters

NameType
Tupleextends any[]

Defined in

packages/core/src/codecs/tuple.ts:8


TupleEncoders

Ƭ TupleEncoders<Tuple>: Tuple extends [infer Head, ...(infer Tail)] ? [Encode<Head>, ...TupleEncoders<Tail>] : []

Type parameters

NameType
Tupleextends any[]

Defined in

packages/core/src/codecs/tuple.ts:4


VariantAny

Ƭ VariantAny: Variant<any, any, any>

Defined in

packages/enum/src/lib.ts:19


VariantToFactoryArgs

Ƭ VariantToFactoryArgs<V>: V extends Variant<any, infer Tag, infer Content> ? Content extends [infer C] ? [tag: Tag, content: C] : [tag: Tag] : never

Type parameters

NameType
Vextends VariantAny

Defined in

packages/enum/src/lib.ts:32

Functions

countPositiveBigIntEffectiveBytes

countPositiveBigIntEffectiveBytes(positiveNum): number

Parameters

NameType
positiveNumbigint

Returns

number

Defined in

packages/core/src/codecs/int.ts:172


createArrayDecoder

createArrayDecoder<T>(decodeItem, len): Decode<T[]>

Type parameters

Name
T

Parameters

NameType
decodeItemDecode<T>
lennumber

Returns

Decode<T[]>

Defined in

packages/core/src/codecs/array.ts:40


createArrayEncoder

createArrayEncoder<T>(encodeItem, len): Encode<T[]>

Type parameters

Name
T

Parameters

NameType
encodeItemEncode<T>
lennumber

Returns

Encode<T[]>

Defined in

packages/core/src/codecs/array.ts:25


createBigIntDecoder

createBigIntDecoder(ty): Decode<bigint>

Parameters

NameType
tyBigIntTypes

Returns

Decode<bigint>

Defined in

packages/core/src/codecs/int.ts:265


createBigIntEncoder

createBigIntEncoder(ty): Encode<bigint>

Parameters

NameType
tyBigIntTypes

Returns

Encode<bigint>

Defined in

packages/core/src/codecs/int.ts:261


createEnumDecoder

createEnumDecoder<V>(decoders): Decode<V>

Type parameters

NameType
Vextends Variant<any, any, any, V>

Parameters

NameType
decodersEnumDecoders<EnumOf<V>>

Returns

Decode<V>

Defined in

packages/core/src/codecs/enum.ts:111


createEnumEncoder

createEnumEncoder<V>(encoders): Encode<V>

Type parameters

NameType
Vextends Variant<any, any, any, V>

Parameters

NameType
encodersEnumEncoders<EnumOf<V>>

Returns

Encode<V>

Defined in

packages/core/src/codecs/enum.ts:77


createIntDecoder

createIntDecoder(ty): Decode<number>

Parameters

NameType
ty"i16" | "i8" | "i32" | "u16" | "u8" | "u32"

Returns

Decode<number>

Defined in

packages/core/src/codecs/int.ts:257


createIntEncoder

createIntEncoder(ty): Encode<number>

Parameters

NameType
ty"i16" | "i8" | "i32" | "u16" | "u8" | "u32"

Returns

Encode<number>

Defined in

packages/core/src/codecs/int.ts:253


createMapDecoder

createMapDecoder<K, V>(decodeKey, decodeValue): Decode<Map<K, V>>

Type parameters

Name
K
V

Parameters

NameType
decodeKeyDecode<K>
decodeValueDecode<V>

Returns

Decode<Map<K, V>>

Defined in

packages/core/src/codecs/map.ts:45


createMapEncoder

createMapEncoder<K, V>(encodeKey, encodeValue): Encode<Map<K, V>>

Type parameters

Name
K
V

Parameters

NameType
encodeKeyEncode<K>
encodeValueEncode<V>

Returns

Encode<Map<K, V>>

Defined in

packages/core/src/codecs/map.ts:38


createOptionDecoder

createOptionDecoder<T>(decodeSome): Decode<RustOption<T>>

Type parameters

Name
T

Parameters

NameType
decodeSomeDecode<T>

Returns

Decode<RustOption<T>>

Defined in

packages/core/src/codecs/enum.ts:122


createOptionEncoder

createOptionEncoder<T>(encodeSome): Encode<RustOption<T>>

Type parameters

Name
T

Parameters

NameType
encodeSomeEncode<T>

Returns

Encode<RustOption<T>>

Defined in

packages/core/src/codecs/enum.ts:115


createResultDecoder

createResultDecoder<Ok, Err>(decodeOk, decodeErr): Decode<RustResult<Ok, Err>>

Type parameters

Name
Ok
Err

Parameters

NameType
decodeOkDecode<Ok>
decodeErrDecode<Err>

Returns

Decode<RustResult<Ok, Err>>

Defined in

packages/core/src/codecs/enum.ts:139


createResultEncoder

createResultEncoder<Ok, Err>(encodeOk, encodeErr): Encode<RustResult<Ok, Err>>

Type parameters

Name
Ok
Err

Parameters

NameType
encodeOkEncode<Ok>
encodeErrEncode<Err>

Returns

Encode<RustResult<Ok, Err>>

Defined in

packages/core/src/codecs/enum.ts:129


createSetDecoder

createSetDecoder<T>(decodeItem): Decode<Set<T>>

Type parameters

Name
T

Parameters

NameType
decodeItemDecode<T>

Returns

Decode<Set<T>>

Defined in

packages/core/src/codecs/set.ts:36


createSetEncoder

createSetEncoder<T>(encodeItem): Encode<Set<T>>

Type parameters

Name
T

Parameters

NameType
encodeItemEncode<T>

Returns

Encode<Set<T>>

Defined in

packages/core/src/codecs/set.ts:29


createStructDecoder

createStructDecoder<T>(decoders): Decode<T>

Type parameters

NameType
Textends Object

Parameters

NameType
decodersStructDecoders<T>

Returns

Decode<T>

Defined in

packages/core/src/codecs/struct.ts:40


createStructEncoder

createStructEncoder<T>(encoders): Encode<T>

Type parameters

NameType
Textends Object

Parameters

NameType
encodersStructEncoders<T>

Returns

Encode<T>

Defined in

packages/core/src/codecs/struct.ts:24


createTupleDecoder

createTupleDecoder<T>(decoders): Decode<T>

Type parameters

NameType
Textends any[]

Parameters

NameType
decodersTupleDecoders<T>

Returns

Decode<T>

Defined in

packages/core/src/codecs/tuple.ts:44


createTupleEncoder

createTupleEncoder<T>(encoders): Encode<T>

Type parameters

NameType
Textends any[]

Parameters

NameType
encodersTupleEncoders<T>

Returns

Encode<T>

Defined in

packages/core/src/codecs/tuple.ts:37


createUint8ArrayDecoder

createUint8ArrayDecoder(len): Decode<Uint8Array>

Parameters

NameType
lennumber

Returns

Decode<Uint8Array>

Defined in

packages/core/src/codecs/array.ts:79


createUint8ArrayEncoder

createUint8ArrayEncoder(len): Encode<Uint8Array>

Parameters

NameType
lennumber

Returns

Encode<Uint8Array>

Defined in

packages/core/src/codecs/array.ts:53


createVecDecoder

createVecDecoder<T>(decodeItem): Decode<T[]>

Type parameters

Name
T

Parameters

NameType
decodeItemDecode<T>

Returns

Decode<T[]>

Defined in

packages/core/src/codecs/vec.ts:33


createVecEncoder

createVecEncoder<T>(encodeItem): Encode<T[]>

Type parameters

Name
T

Parameters

NameType
encodeItemEncode<T>

Returns

Encode<T[]>

Defined in

packages/core/src/codecs/vec.ts:21


decodeArray

decodeArray<T>(walker, decodeItem, len): T[]

Type parameters

Name
T

Parameters

NameType
walkerWalker
decodeItemDecode<T>
lennumber

Returns

T[]

Defined in

packages/core/src/codecs/array.ts:32


decodeBigInt

decodeBigInt(walker, ty): bigint

Decodes bigint in Little-Endian

Parameters

NameType
walkerWalker
tyBigIntTypes

Returns

bigint

Defined in

packages/core/src/codecs/int.ts:238


decodeBigIntVarious

decodeBigIntVarious(walker, bytes, signed): bigint

Decodes bigint in Little-Endian. It is like decodeBigInt but is not binded to strict bytes count (1, 2, 4, 8, 16 etc)

Remarks

Does not mutate walker's offset!

Parameters

NameType
walkerWalker
bytesnumber
signedboolean

Returns

bigint

Defined in

packages/core/src/codecs/int.ts:216


decodeBool

decodeBool(walker): boolean

Parameters

NameType
walkerWalker

Returns

boolean

Defined in

packages/core/src/types.ts:1


decodeCompact

decodeCompact(walker): bigint

Decodes compact-encoded integer

Parameters

NameType
walkerWalker

Returns

bigint

Defined in

packages/core/src/codecs/compact.ts:17


decodeEnum

decodeEnum<V>(walker, decoders): V

Type parameters

NameType
Vextends Variant<any, any, any, V>

Parameters

NameType
walkerWalker
decodersEnumDecoders<EnumOf<V>>

Returns

V

Defined in

packages/core/src/codecs/enum.ts:97


decodeI128

decodeI128(walker): bigint

Parameters

NameType
walkerWalker

Returns

bigint

Defined in

packages/core/src/types.ts:1


decodeI16

decodeI16(walker): number

Parameters

NameType
walkerWalker

Returns

number

Defined in

packages/core/src/types.ts:1


decodeI32

decodeI32(walker): number

Parameters

NameType
walkerWalker

Returns

number

Defined in

packages/core/src/types.ts:1


decodeI64

decodeI64(walker): bigint

Parameters

NameType
walkerWalker

Returns

bigint

Defined in

packages/core/src/types.ts:1


decodeI8

decodeI8(walker): number

Parameters

NameType
walkerWalker

Returns

number

Defined in

packages/core/src/types.ts:1


decodeInt

decodeInt(walker, ty): number

Decodes signed/unsigned 8/16/32 bits integers in Little-Endian

Parameters

NameType
walkerWalker
ty"i16" | "i8" | "i32" | "u16" | "u8" | "u32"

Returns

number

Defined in

packages/core/src/codecs/int.ts:89


decodeMap

decodeMap<K, V>(walker, decodeKey, decodeValue): Map<K, V>

Type parameters

Name
K
V

Parameters

NameType
walkerWalker
decodeKeyDecode<K>
decodeValueDecode<V>

Returns

Map<K, V>

Defined in

packages/core/src/codecs/map.ts:29


decodeOptionBool

decodeOptionBool(walker): RustOption<boolean>

Special decoder for OptionBool type from Rust's parity_scale_codec

Parameters

NameType
walkerWalker

Returns

RustOption<boolean>

Defined in

packages/core/src/types.ts:1


decodeSet

decodeSet<T>(walker, decodeItem): Set<T>

Type parameters

Name
T

Parameters

NameType
walkerWalker
decodeItemDecode<T>

Returns

Set<T>

Defined in

packages/core/src/codecs/set.ts:20


decodeStr

decodeStr(walker): string

Parameters

NameType
walkerWalker

Returns

string

Defined in

packages/core/src/codecs/str.ts:12


decodeStruct

decodeStruct<T>(walker, decoders): T

Type parameters

NameType
Textends Object

Parameters

NameType
walkerWalker
decodersStructDecoders<T>

Returns

T

Defined in

packages/core/src/codecs/struct.ts:31


decodeTuple

decodeTuple<T>(walker, decoders): T

Type parameters

NameType
Textends any[]

Parameters

NameType
walkerWalker
decodersTupleDecoders<T>

Returns

T

Defined in

packages/core/src/codecs/tuple.ts:27


decodeU128

decodeU128(walker): bigint

Parameters

NameType
walkerWalker

Returns

bigint

Defined in

packages/core/src/types.ts:1


decodeU16

decodeU16(walker): number

Parameters

NameType
walkerWalker

Returns

number

Defined in

packages/core/src/types.ts:1


decodeU32

decodeU32(walker): number

Parameters

NameType
walkerWalker

Returns

number

Defined in

packages/core/src/types.ts:1


decodeU64

decodeU64(walker): bigint

Parameters

NameType
walkerWalker

Returns

bigint

Defined in

packages/core/src/types.ts:1


decodeU8

decodeU8(walker): number

Parameters

NameType
walkerWalker

Returns

number

Defined in

packages/core/src/types.ts:1


decodeUint8Array

decodeUint8Array(walker, len): Uint8Array

decode [u8; x] array directly into the native Uint8Array

Parameters

NameType
walkerWalker
lennumber

Returns

Uint8Array

Defined in

packages/core/src/codecs/array.ts:66


decodeUint8Vec

decodeUint8Vec(walker): Uint8Array

Parameters

NameType
walkerWalker

Returns

Uint8Array

Defined in

packages/core/src/types.ts:1


decodeUnit

decodeUnit(walker): null

Decoder to handle unit type (i.e. ())

Parameters

NameType
walkerWalker

Returns

null

Defined in

packages/core/src/types.ts:1


decodeVec

decodeVec<T>(walker, decodeItem): T[]

Type parameters

Name
T

Parameters

NameType
walkerWalker
decodeItemDecode<T>

Returns

T[]

Defined in

packages/core/src/codecs/vec.ts:28


encodeArray

encodeArray<T>(arr, encodeItem, len, walker): void

Type parameters

Name
T

Parameters

NameType
arrT[]
encodeItemEncode<T>
lennumber
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/array.ts:5


encodeArraySizeHint

encodeArraySizeHint<T>(arr, encodeItem, len): number

Type parameters

Name
T

Parameters

NameType
arrT[]
encodeItemEncode<T>
lennumber

Returns

number

Defined in

packages/core/src/codecs/array.ts:14


encodeBigInt

encodeBigInt(bi, ty, walker): void

Encodes bigint in Little-Endian

Parameters

NameType
bibigint
tyBigIntTypes
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/int.ts:185


encodeBool

encodeBool(value, walker): void

Parameters

NameType
valueboolean
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeCompact

encodeCompact(value, walker): void

Parameters

NameType
valuenumber | bigint
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeEnum

encodeEnum<V>(value, encoders, walker): void

Type parameters

NameType
Vextends Variant<any, any, any, V>

Parameters

NameType
valueV
encodersEnumEncoders<EnumOf<V>>
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/enum.ts:48


encodeEnumSizeHint

encodeEnumSizeHint<V>(value, encoders): number

Type parameters

NameType
Vextends Variant<any, any, any, V>

Parameters

NameType
valueV
encodersEnumEncoders<EnumOf<V>>

Returns

number

Defined in

packages/core/src/codecs/enum.ts:59


encodeFactory

encodeFactory<T>(fn, sizeHint): Encode<T>

Type parameters

Name
T

Parameters

NameType
fn(value: T, walker: Walker) => void
sizeHint(value: T) => number

Returns

Encode<T>

Defined in

packages/core/src/util.ts:44


encodeI128

encodeI128(value, walker): void

Parameters

NameType
valuebigint
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeI16

encodeI16(value, walker): void

Parameters

NameType
valuenumber
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeI32

encodeI32(value, walker): void

Parameters

NameType
valuenumber
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeI64

encodeI64(value, walker): void

Parameters

NameType
valuebigint
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeI8

encodeI8(value, walker): void

Parameters

NameType
valuenumber
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeInt

encodeInt(value, ty, walker): void

Encodes signed/unsigned 8/16/32 bits integers in Little-Endian

Parameters

NameType
valuenumber
ty"i16" | "i8" | "i32" | "u16" | "u8" | "u32"
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/int.ts:56


encodeMap

encodeMap<K, V>(map, encodeKey, encodeValue, walker): void

Type parameters

Name
K
V

Parameters

NameType
mapMap<K, V>
encodeKeyEncode<K>
encodeValueEncode<V>
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/map.ts:6


encodeMapSizeHint

encodeMapSizeHint<K, V>(map, encodeKey, encodeValue): number

Type parameters

Name
K
V

Parameters

NameType
mapMap<K, V>
encodeKeyEncode<K>
encodeValueEncode<V>

Returns

number

Defined in

packages/core/src/codecs/map.ts:14


encodeOptionBool

encodeOptionBool(value, walker): void

Special encoder for OptionBool type from Rust's parity_scale_codec

Parameters

NameType
valueRustOption<boolean>
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodePositiveBigIntInto

encodePositiveBigIntInto(positiveNum, mutSlice, offset, bytesLimit): number

Parameters

NameType
positiveNumbigint
mutSliceUint8Array
offsetnumber
bytesLimitnumber

Returns

number

Defined in

packages/core/src/codecs/int.ts:152


encodeSet

encodeSet<T>(set, encodeItem, walker): void

Type parameters

Name
T

Parameters

NameType
setSet<T>
encodeItemEncode<T>
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/set.ts:5


encodeSetSizeHint

encodeSetSizeHint<T>(set, encodeItem): number

Type parameters

Name
T

Parameters

NameType
setSet<T>
encodeItemEncode<T>

Returns

number

Defined in

packages/core/src/codecs/set.ts:12


encodeStr

encodeStr(value, walker): void

Parameters

NameType
valuestring
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeStruct

encodeStruct<T>(struct, encoders, walker): void

Type parameters

NameType
Textends Object

Parameters

NameType
structT
encodersStructEncoders<T>
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/struct.ts:8


encodeStructSizeHint

encodeStructSizeHint<T>(struct, encoders): number

Type parameters

NameType
Textends Object

Parameters

NameType
structT
encodersStructEncoders<T>

Returns

number

Defined in

packages/core/src/codecs/struct.ts:15


encodeTuple

encodeTuple<T>(tuple, encoders, walker): void

Type parameters

NameType
Textends any[]

Parameters

NameType
tupleT
encodersTupleEncoders<T>
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/tuple.ts:12


encodeTupleSizeHint

encodeTupleSizeHint<T>(tuple, encoders): number

Type parameters

NameType
Textends any[]

Parameters

NameType
tupleT
encodersTupleEncoders<T>

Returns

number

Defined in

packages/core/src/codecs/tuple.ts:17


encodeU128

encodeU128(value, walker): void

Parameters

NameType
valuebigint
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeU16

encodeU16(value, walker): void

Parameters

NameType
valuenumber
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeU32

encodeU32(value, walker): void

Parameters

NameType
valuenumber
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeU64

encodeU64(value, walker): void

Parameters

NameType
valuebigint
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeU8

encodeU8(value, walker): void

Parameters

NameType
valuenumber
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeUint8Array

encodeUint8Array(value, len, walker): void

Encode to [u8; x] Rust's array directly from the native Uint8Array

Parameters

NameType
valueUint8Array
lennumber
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/array.ts:47


encodeUint8Vec

encodeUint8Vec(value, walker): void

Parameters

NameType
valueUint8Array
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeUnit

encodeUnit(value, walker): void

Encoder to handle unit type (i.e. ())

Parameters

NameType
valuenull
walkerWalker

Returns

void

Defined in

packages/core/src/types.ts:4


encodeVec

encodeVec<T>(vec, encodeItem, walker): void

Type parameters

Name
T

Parameters

NameType
vecT[]
encodeItemEncode<T>
walkerWalker

Returns

void

Defined in

packages/core/src/codecs/vec.ts:6


encodeVecSizeHint

encodeVecSizeHint<T>(vec, encodeItem): number

Type parameters

Name
T

Parameters

NameType
vecT[]
encodeItemEncode<T>

Returns

number

Defined in

packages/core/src/codecs/vec.ts:13


variant

variant<V>(...args): V

Type parameters

NameType
Vextends Variant<any, any, any, V>

Parameters

NameType
...argsVariantToFactoryArgs<V>

Returns

V

Defined in

packages/enum/src/lib.ts:28

variant<E>(...args): Enumerate<E>

Type parameters

NameType
Eextends EnumRecord

Parameters

NameType
...argsVariantToFactoryArgs<Enumerate<E>>

Returns

Enumerate<E>

Defined in

packages/enum/src/lib.ts:29