Skip to main content

Type

The

Type module provides the Expression types.

StdLib

DefaultValue

DefaultValue<T>(type): ValueTypeOf<T>

Create a default

Value of a given East type.

Type parameters

NameType
Textends EastType

Parameters

NameTypeDescription
typeTthe EastType

Returns

ValueTypeOf<T>

Remarks

For nullable types this is null, otherwise numeric types default to zero, Boolean to false, strings, arrays, sets and dictionaries are empty, for variants the first variant type is chosen, and structs are created recursively.

Type

ArrayType

Ƭ ArrayType<T>: Object

An EastType for a 0-indexed array of values of uniform type. Represented by Array in the JavaScript runtime, such as ["a", "b", "c"].

Type parameters

NameType
Textends EastType = EastType

Type declaration

NameType
type"Array"
valueT

ArrayValue

Ƭ ArrayValue:

Value[]

An

ArrayValue


BlobType

Ƭ BlobType: Object

An EastType for a binary blob - a collection of bytes.

Type declaration

NameType
type"Blob"
valuenull

BlobValue

Ƭ BlobValue: Uint8Array

A

BlobValue


BooleanType

Ƭ BooleanType: Object

An EastType for true or false.

Type declaration

NameType
type"Boolean"
valuenull

DateTimeType

Ƭ DateTimeType: Object

An EastType for a UTC datetime. Represented by Dates in the JavaScript runtime, such as new Date("2022-01-01T00:00:00.000Z").

Type declaration

NameType
type"DateTime"
valuenull

DictType

Ƭ DictType<K, T>: Object

An EastType for a dictionary of keys and values of uniform types. Currently the keys must be strings. Represented by Map in the JavaScript runtime, such as new Map<string, boolean>([["a", true], ["b", false]]).

Type parameters

NameType
Kextends StringType = StringType
Textends EastType = EastType

Type declaration

NameType
type"Dict"
value{ key: K ; value: T }
value.keyK
value.valueT

DictValue

Ƭ DictValue: Map<string,

Value>

A

DictValue


FloatType

Ƭ FloatType: Object

An EastType for 64-bit IEEE 654 floating-point numbers. Represented by numbers in the JavaScript runtime, such as 0, 3.14, Infinity, etc.

Type declaration

NameType
type"Float"
valuenull

IntegerType

Ƭ IntegerType: Object

An EastType for 64-bit signed integers. Represented by bigints in the JavaScript runtime, such as 0n, 1n, etc.

Type declaration

NameType
type"Integer"
valuenull

NullType

Ƭ NullType: Object

An EastType for a dataless value, null.

Type declaration

NameType
nullabletrue

Nullable

Ƭ Nullable<T>: T & { nullable: true }

An EastType for a nullable value of another type, where values may optionally be null.

Example

type NullableStringType = Nullable<StringType>
const NullableStringType = Nullable(StringType)

Type parameters

NameType
Textends EastType = EastType

NumericType

Ƭ NumericType:

FloatType | IntegerType

A subset of EastType relating to numeric values.


NumericValue

Ƭ NumericValue: number | bigint

A subset of

Value relating to numeric values.


PrimitiveValue

Ƭ PrimitiveValue: null | string | number | boolean | bigint | Date

A subset of

Value relating to primitive values.


SetType

Ƭ SetType<K>: Object

An EastType for a set of distinct keys of a uniform type. Currently keys must be strings, and are represented by Set<string> in the JavaScript runtime, such as new Set<string>(["a", "b", "c"]).

Type parameters

NameType
Kextends StringType = StringType

Type declaration

NameType
type"Set"
valueK

SetValue

Ƭ SetValue: Set<string>

A

SetValue


StringType

Ƭ StringType: Object

An EastType for a unicode text string. Represented by strings in the JavaScript runtime, such as "abc".

Type declaration

NameType
type"String"
valuenull

StructType

Ƭ StructType<T>: Object

An EastType for a struct of values (also known as a records, product types or objects). A struct contains a fixed set of named fields with value of the corresponding type for each. In the JavaScript runtime these are represented as objects such as { a: true, b: "abc" }.

Type parameters

NameType
Textends Record<string, EastType> = Record<string, EastType>

Type declaration

NameType
type"Struct"
valueT

StructValue

Ƭ StructValue: Object

A

StructValue

Index signature

▪ [key: string]:

Value


Value

Ƭ Value:

PrimitiveValue | ArrayValue | SetValue | DictValue | VariantValue | StructValue | BlobValue

A

Value


VariantType

Ƭ VariantType<T>: Object

An EastType for a variant (also known as tagged unions, sum types, or enumerations). A variant value consists of a one of the possible "tags" along with any associated data, and can constructed with the Variant function.

Type parameters

NameType
Textends Record<string, EastType> = Record<string, EastType>

Type declaration

NameType
type"Variant"
valueT

VariantValue

Ƭ VariantValue: Object

A

VariantValue

Type declaration

NameType
[Data]Value
typestring

ArrayType

ArrayType<T>(value):

ArrayType<T>

Return an ArrayType with the given value type.

Type parameters

NameType
Textends EastType

Parameters

NameTypeDescription
valueTthe type of the array's values

Returns

ArrayType<T>


DictType

DictType<K, T>(key, value):

DictType<K, T>

Construct a DictType with the given key and value types

Type parameters

NameType
Kextends StringType
Textends EastType

Parameters

NameTypeDescription
keyKthe type of the dictionary's keys
valueTthe type of the dictionary's values

Returns

DictType<K, T>


SetType

SetType<K>(key):

SetType<K>

Return a SetType with the corresponding key type.

Type parameters

NameType
Kextends StringType

Parameters

NameTypeDescription
keyKthe type of the set's keys

Returns

SetType<K>


StructType

StructType<T>(fields):

StructType<T>

Return a StructType with the given field names and corresponding types.

Type parameters

NameType
Textends Record<string, EastType>

Parameters

NameTypeDescription
fieldsTa record of the struct's fields and their corresponding types

Returns

StructType<T>


VariantType

VariantType<T>(cases):

VariantType<T>

Return a VariantType with the corresponding tag names and associated types.

Type parameters

NameType
Textends Record<string, EastType>

Parameters

NameTypeDescription
casesTa record of the variant case (or tag) names and their associated types

Returns

VariantType<T>