(ast: AST): Schema.Annotations.Annotations | undefinedReturns all annotations from the AST node.
Details
If the node has Checks, returns annotations from the last check
(which is where user-supplied annotations end up after .pipe(Schema.annotations(...))).
Otherwise returns Base.annotations directly.
Example (Reading annotations)
import { Schema, SchemaAST } from "effect"
const schema = Schema.String.annotate({ title: "Name" })
const annotations = SchemaAST.resolve(schema.ast)
console.log(annotations?.title) // "Name"export const const resolve: (
ast: AST
) => Schema.Annotations.Annotations | undefined
Returns all annotations from the AST node.
Details
If the node has
Checks
, returns annotations from the last check
(which is where user-supplied annotations end up after .pipe(Schema.annotations(...))).
Otherwise returns Base.annotations directly.
Example (Reading annotations)
import { Schema, SchemaAST } from "effect"
const schema = Schema.String.annotate({ title: "Name" })
const annotations = SchemaAST.resolve(schema.ast)
console.log(annotations?.title) // "Name"
resolve: (ast: ASTast: 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) => import SchemaSchema.declareAnnotations.type Schema.Annotations.Annotations = /*unresolved*/ anyAnnotations | undefined = import InternalAnnotationsInternalAnnotations.function resolve(
ast: SchemaAST.AST
): Schema.Annotations.Annotations | undefined
resolve