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

Function encodeUnknownSync

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

Source from the content-addressed store, hash-verified

2309 * @since 4.0.0
2310 */
2311export function encodeUnknownSync<S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) {
2312 const parser = encodeUnknownEffect(schema, options)
2313 return (input: unknown, options?: SchemaAST.ParseOptions): S["Encoded"] => {
2314 return runSchemaErrorSync(parser(input, options) as Effect.Effect<S["Encoded"], SchemaError>)
2315 }
2316}
2317
2318/**
2319 * Encodes a typed input (the schema's `Type`) against a schema synchronously,

Callers

nothing calls this directly

Calls 2

runSchemaErrorSyncFunction · 0.85
encodeUnknownEffectFunction · 0.70

Tested by

no test coverage detected