Skip to content

parseUnknown()

ts
function parseUnknown(data): ParseSuccess<unknown>

A parser that always succeeds. Parsing unknown always succeeds because all values can be assigned to unknownunknown 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

ParameterTypeDescription
dataunknowndata to be validated

Returns

ParseSuccess<unknown>