TypeExpr
type-alias type-only low-levelA type, as data.
Declaration
export type TypeExpr =
/** An arktype DEFINITION (string expression or object form): primitives, literals, unions, arrays, tuples, plain objects. */
| { data: Json }
/** A live object satisfying another interface — a key into the {@link IfaceTable}. */
| { iface: string }
/** A callback. */
| { fn: Sig }
| { promise: TypeExpr }
/** AsyncIterable<T>; an AsyncGenerator's return value rides in `returns`. */
| { stream: TypeExpr; returns?: TypeExpr }
| { void: true }
/** An array whose element is not data (promises, callbacks, live objects). */
| { array: TypeExpr }
/** Map<K, V>: a live keyed collection, as `[key, value]`. */
| { map: readonly [TypeExpr, TypeExpr] }
/** Set<T>: a live collection of T. */
| { set: TypeExpr }
/** A plain object shape with at least one non-data member, compared member by member. */
| { object: Record<string, TypeExpr>; optional?: readonly string[] }
/** `T | null | undefined` around a non-data T. */
| { maybe: TypeExpr }
/** A union with more than one non-data member (a provider, or a promise of one). */
| { oneOf: readonly TypeExpr[] }
/**
* A host object compared by NAME only (AbortSignal, Request…): platform types the
* generator meets in a .d.ts, or a package's own class written as `Opaque<"Name">`.
*/
| { opaque: string };Union Variants (13)
Variant 1
{ data: Json }An arktype DEFINITION (string expression or object form): primitives, literals, unions, arrays, tuples, plain objects.
Variant 2
{ iface: string }A live object satisfying another interface — a key into the IfaceTable.
Variant 4
{ promise: TypeExpr }Variant 5
{ stream: TypeExpr; returns?: TypeExpr }AsyncIterable; an AsyncGenerator's return value rides in returns.
Variant 6
{ void: true }Variant 7
{ array: TypeExpr }An array whose element is not data (promises, callbacks, live objects).
Variant 8
{ map: readonly [TypeExpr, TypeExpr] }Map<K, V>: a live keyed collection, as [key, value].
Variant 9
{ set: TypeExpr }Set: a live collection of T.
Variant 10
{ object: Record<string, TypeExpr>; optional?: readonly string[] }A plain object shape with at least one non-data member, compared member by member.
Variant 11
{ maybe: TypeExpr }T | null | undefined around a non-data T.
Variant 12
{ oneOf: readonly TypeExpr[] }A union with more than one non-data member (a provider, or a promise of one).
Variant 13
{ opaque: string }A host object compared by NAME only (AbortSignal, Request…): platform types the
generator meets in a .d.ts, or a package's own class written as Opaque<"Name">.