parseUnknown()
ts
function parseUnknown(data): ParseSuccess<unknown>
A parser that always succeeds. Parsing unknown
always succeeds because all values can be assigned to unknown
—unknown
corresponds to the set of all values.
See
parseNever for a counterpart
Example
Use to skip validation, as it results in a success for any input.
ts
const parseResponse = object({
status: parseNumber,
data: unknown,
})
parseResponse({
status: 200,
data: { id: 123, name: 'John' }
}) // => ParseSuccess<{ status: number, data: unknown }>
Parameters
Parameter | Type | Description |
---|---|---|
data | unknown | data to be validated |
Returns
ParseSuccess
<unknown
>