MCPcopy Create free account
hub / github.com/Effect-TS/effect / encodeUnknownSync

Function encodeUnknownSync

packages/effect/src/Schema.ts:2287–2292  ·  view source on GitHub ↗
(schema: S, options?: SchemaAST.ParseOptions)

Source from the content-addressed store, hash-verified

2285 * @since 4.0.0
2286 */
2287export function encodeUnknownSync<S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) {
2288 const parser = encodeUnknownEffect(schema, options)
2289 return (input: unknown, options?: SchemaAST.ParseOptions): S["Encoded"] => {
2290 return runSchemaErrorSync(parser(input, options) as Effect.Effect<S["Encoded"], SchemaError>)
2291 }
2292}
2293/**
2294 * Encodes a typed input (the schema's `Type`) against a schema synchronously,
2295 * throwing a {@link SchemaError} for schema mismatches.

Callers

nothing calls this directly

Calls 3

runSchemaErrorSyncFunction · 0.85
encodeUnknownEffectFunction · 0.70
parserFunction · 0.70

Tested by

no test coverage detected