| 164 | |
| 165 | /** @internal */ |
| 166 | export function _issue<T>(ast: SchemaAST.AST) { |
| 167 | const parser = run<T, never>(ast) |
| 168 | return (input: unknown, options: SchemaAST.ParseOptions): SchemaIssue.Issue | undefined => { |
| 169 | const exit = Effect.runSyncExit(parser(input, options)) |
| 170 | if (Exit.isSuccess(exit)) { |
| 171 | return undefined |
| 172 | } |
| 173 | return InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, "Issue adapter can only return schema issues") |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * Asserts that an input satisfies the schema's decoded type side. |