(schema: S)
| 71 | * @since 4.0.0 |
| 72 | */ |
| 73 | export function makeOption<S extends Schema.Constraint>(schema: S) { |
| 74 | const parser = makeEffect(schema) |
| 75 | return (input: S["~type.make.in"], options?: Schema.MakeOptions): Option.Option<S["Type"]> => { |
| 76 | const exit = Effect.runSyncExit(parser(input, options)) |
| 77 | if (Exit.isSuccess(exit)) { |
| 78 | return Option.some(exit.value) |
| 79 | } |
| 80 | InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, "Option adapter can only return none for schema issues") |
| 81 | return Option.none() |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Creates a synchronous maker for the schema's decoded type side. |
nothing calls this directly
no test coverage detected