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

Function make

packages/effect/src/SchemaParser.ts:110–123  ·  view source on GitHub ↗
(schema: S)

Source from the content-addressed store, hash-verified

108 * @since 4.0.0
109 */
110export function make<S extends Schema.Constraint>(schema: S) {
111 const parser = makeEffect(schema)
112 return (input: S["~type.make.in"], options?: Schema.MakeOptions): S["Type"] => {
113 const exit = Effect.runSyncExit(parser(input, options))
114 if (Exit.isSuccess(exit)) {
115 return exit.value
116 }
117 const issue = InternalSchemaCause.getSchemaIssueOrThrow(
118 exit.cause,
119 "Constructor adapter can only throw schema issues"
120 )
121 throw new Error("Schema validation failed", { cause: issue })
122 }
123}
124
125/**
126 * Creates a type guard that checks whether an input satisfies the schema's decoded

Callers

nothing calls this directly

Calls 1

makeEffectFunction · 0.70

Tested by

no test coverage detected