Skip to main content

Function: assertNever()

assertNever(value: never, context: string): never

Defined in: shared/utils/assertions.ts:54

Helper for enforcing exhaustive checks in discriminated unions.

Parametersโ€‹

valueโ€‹

never

Value that should be impossible at this point in the control flow.

contextโ€‹

string = "exhaustive-check"

Optional label describing the check site.

Returnsโ€‹

never

Throwsโ€‹

Always throws an error including a description of the unexpected value.