(declaration: Declaration, recur: (representation: Representation) => T):
| T
| undefinedA callback that handles Declaration nodes during reconstruction (toSchema) or code generation (toCodeDocument).
Details
Return a value to handle the declaration. Return undefined to fall back to
default behavior, which uses encodedSchema for toSchema or the
generation annotation for toCodeDocument. recur processes child
representations recursively.
export type type Reviver<T> = (
declaration: Declaration,
recur: (representation: Representation) => T
) => T | undefined
A callback that handles
Declaration
nodes during reconstruction
(
toSchema
) or code generation (
toCodeDocument
).
Details
Return a value to handle the declaration. Return undefined to fall back to
default behavior, which uses encodedSchema for toSchema or the
generation annotation for toCodeDocument. recur processes child
representations recursively.
Reviver<function (type parameter) T in type Reviver<T>T> = (declaration: Declaration(parameter) declaration: {
_tag: "Declaration";
annotations: Schema.Annotations.Annotations | undefined;
typeParameters: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<DeclarationMeta>>;
encodedSchema: Representation;
}
declaration: Declaration, recur: (representation: Representation) => Trecur: (representation: Representationrepresentation: type Representation =
| Declaration
| Reference
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
The core tagged union of all supported schema shapes.
Details
Each variant has a _tag discriminator. Switch on _tag to handle each
shape. Most variants carry optional annotations and some carry checks
for validation constraints.
Representation) => function (type parameter) T in type Reviver<T>T) => function (type parameter) T in type Reviver<T>T | undefined