parseNever()
ts
function parseNever(data): ParseFailureA 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) // => ParseFailureSee
parseUnknown for the opposite: a parser that always succeeds
Parameters
| Parameter | Type | Description |
|---|---|---|
data | unknown | data to be validated |
