( is: (input: unknown) => input is A, annotations?: Annotations.Schema<A> )
| 1008 | ) |
| 1009 | |
| 1010 | const declarePrimitive = <A>( |
| 1011 | is: (input: unknown) => input is A, |
| 1012 | annotations?: Annotations.Schema<A> |
| 1013 | ): SchemaClass<A> => { |
| 1014 | const decodeUnknown = () => (input: unknown, _: ParseOptions, ast: AST.Declaration) => |
| 1015 | is(input) ? ParseResult.succeed(input) : ParseResult.fail(new ParseResult.Type(ast, input)) |
| 1016 | const encodeUnknown = decodeUnknown |
| 1017 | return makeDeclareClass([], new AST.Declaration([], decodeUnknown, encodeUnknown, toASTAnnotations(annotations))) |
| 1018 | } |
| 1019 | |
| 1020 | /** |
| 1021 | * @category api interface |
no test coverage detected