(schema: S)
| 108 | * @since 4.0.0 |
| 109 | */ |
| 110 | export 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 |
nothing calls this directly
no test coverage detected