Type
The
Type module provides the Expression types.StdLib
DefaultValue
▸ DefaultValue<T>(type): ValueTypeOf<T>
Create a default
Value of a given Easttype.
Type parameters
| Name | Type |
|---|---|
T | extends EastType |
Parameters
| Name | Type | Description |
|---|---|---|
type | T | the 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
| Name | Type |
|---|---|
T | extends EastType = EastType |
Type declaration
| Name | Type |
|---|---|
type | "Array" |
value | T |
ArrayValue
Ƭ ArrayValue:
Value[]
An
ArrayValueBlobType
Ƭ BlobType: Object
An EastType for a binary blob - a collection of bytes.
Type declaration
| Name | Type |
|---|---|
type | "Blob" |
value | null |
BlobValue
Ƭ BlobValue: Uint8Array
A
BlobValueBooleanType
Ƭ BooleanType: Object
An EastType for true or false.
Type declaration
| Name | Type |
|---|---|
type | "Boolean" |
value | null |
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
| Name | Type |
|---|---|
type | "DateTime" |
value | null |
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
| Name | Type |
|---|---|
K | extends StringType = StringType |
T | extends EastType = EastType |
Type declaration
| Name | Type |
|---|---|
type | "Dict" |
value | { key: K ; value: T } |
value.key | K |
value.value | T |
DictValue
Ƭ DictValue: Map<string,
Value>
A
DictValueFloatType
Ƭ 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
| Name | Type |
|---|---|
type | "Float" |
value | null |
IntegerType
Ƭ IntegerType: Object
An EastType for 64-bit signed integers. Represented by bigints in the
JavaScript runtime, such as 0n, 1n, etc.
Type declaration
| Name | Type |
|---|---|
type | "Integer" |
value | null |
NullType
Ƭ NullType: Object
An EastType for a dataless value, null.
Type declaration
| Name | Type |
|---|---|
nullable | true |
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
| Name | Type |
|---|---|
T | extends 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
| Name | Type |
|---|---|
K | extends StringType = StringType |
Type declaration
| Name | Type |
|---|---|
type | "Set" |
value | K |
SetValue
Ƭ SetValue: Set<string>
A
SetValueStringType
Ƭ StringType: Object
An EastType for a unicode text string. Represented by strings in the JavaScript
runtime, such as "abc".
Type declaration
| Name | Type |
|---|---|
type | "String" |
value | null |
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
| Name | Type |
|---|---|
T | extends Record<string, EastType> = Record<string, EastType> |
Type declaration
| Name | Type |
|---|---|
type | "Struct" |
value | T |
StructValue
Ƭ StructValue: Object
A
StructValueIndex signature
▪ [key: string]:
Value
Value
Ƭ Value:
PrimitiveValue | ArrayValue | SetValue | DictValue | VariantValue | StructValue | BlobValue
A
ValueVariantType
Ƭ 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
| Name | Type |
|---|---|
T | extends Record<string, EastType> = Record<string, EastType> |
Type declaration
| Name | Type |
|---|---|
type | "Variant" |
value | T |
VariantValue
Ƭ VariantValue: Object
A
VariantValueType declaration
| Name | Type |
|---|---|
[Data] | Value |
type | string |
ArrayType
▸ ArrayType<T>(value):
ArrayType<T>
Return an ArrayType with the given value type.
Type parameters
| Name | Type |
|---|---|
T | extends EastType |
Parameters
| Name | Type | Description |
|---|---|---|
value | T | the 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
| Name | Type |
|---|---|
K | extends StringType |
T | extends EastType |
Parameters
| Name | Type | Description |
|---|---|---|
key | K | the type of the dictionary's keys |
value | T | the 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
| Name | Type |
|---|---|
K | extends StringType |
Parameters
| Name | Type | Description |
|---|---|---|
key | K | the 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
| Name | Type |
|---|---|
T | extends Record<string, EastType> |
Parameters
| Name | Type | Description |
|---|---|---|
fields | T | a 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
| Name | Type |
|---|---|
T | extends Record<string, EastType> |
Parameters
| Name | Type | Description |
|---|---|---|
cases | T | a record of the variant case (or tag) names and their associated types |
Returns
VariantType<T>