(
s: {
readonly input: unknown
readonly options: ParseOptions
issues: Array<SchemaIssue.Issue> | undefined
},
ast: AST,
key: PropertyKey,
exit: Exit.Failure<any, SchemaIssue.Issue>
)
| 1876 | } |
| 1877 | |
| 1878 | const wrapPropertyKeyIssue = ( |
| 1879 | s: { |
| 1880 | readonly input: unknown |
| 1881 | readonly options: ParseOptions |
| 1882 | issues: Array<SchemaIssue.Issue> | undefined |
| 1883 | }, |
| 1884 | ast: AST, |
| 1885 | key: PropertyKey, |
| 1886 | exit: Exit.Failure<any, SchemaIssue.Issue> |
| 1887 | ) => { |
| 1888 | if (exit.cause.reasons.length === 0) { |
| 1889 | return exit |
| 1890 | } |
| 1891 | const issue = InternalSchemaCause.getSchemaIssue(exit.cause) |
| 1892 | if (issue === undefined) { |
| 1893 | return Exit.failCause( |
| 1894 | Cause.map( |
| 1895 | exit.cause, |
| 1896 | (issue) => |
| 1897 | new SchemaIssue.Composite( |
| 1898 | ast, |
| 1899 | [new SchemaIssue.Pointer([key], issue)], |
| 1900 | s.input, |
| 1901 | s.options |
| 1902 | ) |
| 1903 | ) |
| 1904 | ) |
| 1905 | } |
| 1906 | const pointer = new SchemaIssue.Pointer([key], issue) |
| 1907 | if (s.options.errors === "all") { |
| 1908 | if (s.issues) s.issues.push(pointer) |
| 1909 | else s.issues = [pointer] |
| 1910 | } else { |
| 1911 | return Exit.fail( |
| 1912 | new SchemaIssue.Composite(ast, [pointer], s.input, s.options) |
| 1913 | ) |
| 1914 | } |
| 1915 | } |
| 1916 | |
| 1917 | /** |
| 1918 | * floating point or integer, with optional exponent |
no test coverage detected