MCPcopy Create free account
hub / github.com/effect-app/libs / optionalKey

Interface optionalKey

repos/effect/packages/effect/src/Schema.ts:2215–2235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2213 *
2214 * **Gotchas**
2215 *
2216 * Non-schema failures may reject with a runtime failure instead of
2217 * `SchemaError`.
2218 *
2219 * @see {@link SchemaParser.encodeUnknownPromise} for the adapter that rejects with an `Error` whose cause is `SchemaIssue.Issue`
2220 *
2221 * @category encoding
2222 * @since 3.10.0
2223 */
2224export function encodeUnknownPromise<S extends ConstraintEncoder<unknown>>(
2225 schema: S,
2226 options?: SchemaAST.ParseOptions
2227) {
2228 const parser = encodeUnknownEffect(schema, options)
2229 return (input: unknown, options?: SchemaAST.ParseOptions): Promise<S["Encoded"]> => {
2230 return runSchemaErrorPromise(parser(input, options))
2231 }
2232}
2233
2234/**
2235 * Encodes a typed input (the schema's `Type`) against a schema, returning a
2236 * `Promise` that resolves with the encoded value or rejects with a
2237 * {@link SchemaError} for schema mismatches.
2238 *

Callers 4

Schema.tsFile · 0.70
withDecodingDefaultKeyFunction · 0.70
OptionFromOptionalKeyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…