Skip to main content
Every value type is t.<name>, and an object literal of value types is an object type. The same types declare table fields, function args and returns, and target contracts.

Base types

See Version tokens for declaring fields that store a version for later reads.

Composite types

There are no optional fields. Absence is null: declare the field t.maybe(x) and write null. Declare object fields with a literal. Use t.object(fields) to check an unknown value against those fields with .conforms, .conform, .problem or .check.

Types derived from declarations

Ranked and spatial fields

See Indexes for the orders that serve them.

Sealed fields

label.seal(type) declares a field sealed above the fact’s label. A read returns a Sealed<V>, and ctx.open(sealed) returns the value within the frame’s clearance. See Disclosure.

Time

Time is Temporal; the SDK has no other time helper. The transaction’s entry instant is ctx.frame.now.entry, and its valid instant ctx.frame.at, which is null when the call reads at the present. Values set from ctx.frame.now.entry are entry instants: the commit lands at or after them.
Options that take a duration (history, lifetime, within, every) also accept a duration literal such as { days: 7 }. A fact carries no creation instant of its own: declare a field and set it from ctx.frame.now.entry. Every public SDK type uses these: instants are never epoch numbers, and durations are never bare milliseconds. Name a field for what it is (until, elapsed), not its unit.

Exact durations

An option that takes a duration takes a fixed length. A day is exactly 24 hours, so { days: 30 } is 720 hours in every zone. Years, months and weeks have no fixed length, so they are type errors:
Temporal.Instant.add and subtract refuse days: Temporal throws a RangeError, and the SDK’s declared type says so at compile time. Write hours there (ctx.frame.now.entry.add({ hours: 48 })). To add a duration that may hold days, balance it into hours first:

Exact decimals

Decimal holds an exact decimal number. Build one from its text.

Limits

A value is at most 1 MB, and nests at most 16 levels of objects and arrays. See Limits.