( parser: (input: E, options?: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue> )
| 998 | } |
| 999 | |
| 1000 | function asSync<T, E>( |
| 1001 | parser: (input: E, options?: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue> |
| 1002 | ): (input: E, options?: SchemaAST.ParseOptions) => T { |
| 1003 | const parserExit = asExit(parser) |
| 1004 | return (input: E, options?: SchemaAST.ParseOptions) => { |
| 1005 | const exit = parserExit(input, options) |
| 1006 | if (Exit.isSuccess(exit)) { |
| 1007 | return exit.value |
| 1008 | } |
| 1009 | const issue = InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, "Sync adapter can only throw schema issues") |
| 1010 | throw new Error("Schema validation failed", { cause: issue }) |
| 1011 | } |
| 1012 | } |
| 1013 | |
| 1014 | /** @internal */ |
| 1015 | export interface Parser { |
no test coverage detected