Skip to content

parseNever()

ts
function parseNever(data): ParseFailure

A parser that always fails.

never is the bottom type—the empty set of values—so no value can satisfy it. It is the identity element for oneOf: unioning any parser with parseNever yields that parser unchanged, making it the natural base case when folding a list of parsers into a union. Most users will never call it directly; it is primarily present in the library for completeness.

Example

Always fails:

ts
parseNever(0)      // => ParseFailure
parseNever('abc')  // => ParseFailure
parseNever(null)   // => ParseFailure

See

parseUnknown for the opposite: a parser that always succeeds

Parameters

ParameterTypeDescription
dataunknowndata to be validated

Returns

ParseFailure