| 187 | |
| 188 | /** @internal */ |
| 189 | export function _issue<T>(ast: SchemaAST.AST) { |
| 190 | const parser = run<T, never>(ast) |
| 191 | return (input: unknown, options: SchemaAST.ParseOptions): SchemaIssue.Issue | undefined => { |
| 192 | const exit = Effect.runSyncExit(parser(input, options)) |
| 193 | if (Exit.isSuccess(exit)) { |
| 194 | return undefined |
| 195 | } |
| 196 | return InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, "Issue adapter can only return schema issues") |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * Asserts that an input satisfies the schema's decoded type side. |