effect-io-ai

Package: effect
Module: SchemaAST

SchemaAST.toEncoded

Returns the encoded (wire-format) AST by flipping and then stripping encodings.

Details

Equivalent to toType(flip(ast)). This gives you the AST that describes the shape of the serialized/encoded data.

Example (Getting the encoded AST)

import { Schema, SchemaAST } from "effect"

const schema = Schema.NumberFromString
const encodedAst = SchemaAST.toEncoded(schema.ast)
console.log(encodedAst._tag) // "String"

See

Signature

declare const toEncoded: (ast: AST) => AST

Source

Since v4.0.0