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

Function encodeUnknownPromise

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

Source from the content-addressed store, hash-verified

2217 * @since 3.10.0
2218 */
2219export function encodeUnknownPromise<S extends ConstraintEncoder<unknown>>(
2220 schema: S,
2221 options?: SchemaAST.ParseOptions
2222) {
2223 const parser = encodeUnknownEffect(schema, options)
2224 return (input: unknown, options?: SchemaAST.ParseOptions): Promise<S["Encoded"]> => {
2225 return runSchemaErrorPromise(parser(input, options))
2226 }
2227}
2228/**
2229 * Encodes a typed input (the schema's `Type`) against a schema, returning a
2230 * `Promise` that resolves with the encoded value or rejects with a

Callers 1

Schema.test.tsFile · 0.50

Calls 3

runSchemaErrorPromiseFunction · 0.85
encodeUnknownEffectFunction · 0.70
parserFunction · 0.70

Tested by

no test coverage detected