TopThe existential "any schema" type — all type parameters are erased to unknown.
Details
Use Top as a constraint when writing generic utilities that must accept any
schema regardless of its Type, Encoded, or service requirements. It is the
widest possible schema type and therefore gives you the least static information.
In user code prefer the narrower interfaces:
- Schema
<T>— when you only care about the decoded type - Codec
<T, E, RD, RE>— when you need the encoded type and service requirements - ConstraintDecoder
<T, RD>— for decode-only APIs - ConstraintEncoder
<E, RE>— for encode-only APIs
export interface Top extends
interface Bottom<out T, out E, out RD, out RE, out Ast extends SchemaAST.AST, out Rebuild extends Top, out TypeMakeIn = T, out Iso = T, in out TypeParameters extends ReadonlyArray<Constraint> = readonly [], out TypeMake = TypeMakeIn, out TypeMutability extends Mutability = "readonly", out TypeOptionality extends Optionality = "required", out TypeConstructorDefault extends ConstructorDefault = "no-default", out EncodedMutability extends Mutability = "readonly", out EncodedOptionality extends Optionality = "required">The fully-parameterized base interface for all schemas. Exposes all 14 type
parameters controlling type inference, mutability, optionality, services, and
transformation behavior.
When to use
Use when you are writing advanced generic schema utilities or performing
schema introspection.
Bottom<
unknown,
unknown,
unknown,
unknown,
import SchemaASTSchemaAST.type AST = SchemaAST.Declaration | SchemaAST.Null | SchemaAST.Undefined | SchemaAST.Void | SchemaAST.Never | SchemaAST.Unknown | SchemaAST.Any | SchemaAST.String | SchemaAST.Number | SchemaAST.Boolean | SchemaAST.BigInt | SchemaAST.Symbol | SchemaAST.Literal | SchemaAST.UniqueSymbol | SchemaAST.ObjectKeyword | SchemaAST.Enum | SchemaAST.TemplateLiteral | SchemaAST.Arrays | SchemaAST.Objects | SchemaAST.Union<...> | SchemaAST.SuspendDiscriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST,
Top,
unknown,
unknown,
any, // this is because TypeParameters is invariant
unknown,
type Mutability = "readonly" | "mutable"Whether a schema field is readonly or mutable within a struct.
Mutability,
type Optionality = "required" | "optional"Whether a schema field is required or optional within a struct.
Optionality,
type ConstructorDefault =
| "no-default"
| "with-default"
Whether a schema field has a constructor default value.
ConstructorDefault,
type Mutability = "readonly" | "mutable"Whether a schema field is readonly or mutable within a struct.
Mutability,
type Optionality = "required" | "optional"Whether a schema field is required or optional within a struct.
Optionality
>
{}