(u: unknown): u is ASTReturns true if the value is an AST node (any variant).
Details
Uses the internal TypeId brand to distinguish AST nodes from arbitrary
objects.
guardsAST
Source effect/SchemaAST.ts:933 lines
export function function isAST(u: unknown): u is ASTReturns true if the value is an
AST
node (any variant).
Details
Uses the internal TypeId brand to distinguish AST nodes from arbitrary
objects.
isAST(u: unknownu: unknown): u: unknownu is type AST =
| Declaration
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union<AST>
| Suspend
Discriminated 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 {
return import PredicatePredicate.hasProperty(u: unknownu, const TypeId: "~effect/Schema"TypeId) && u: unknownu[const TypeId: "~effect/Schema"TypeId] === const TypeId: "~effect/Schema"TypeId
}