UNPKG

typedash

Version:

modern, type-safe collection of utility functions

16 lines (14 loc) 557 B
/** * Throws an error if a value is of type `never`. * Used for exhaustive checks. * @param inclusive The value to check. * @param noThrow If `true`, returns `undefined` instead of throwing an error. * @returns This function never returns a value, but throws an error if `inclusive` is of type `never`. * @example * ```typescript * assertNever('foo' as never); // throws an error * assertNever('foo' as never, true); // returns undefined * ``` */ declare function assertNever(inclusive: never, noThrow?: boolean): never; export { assertNever };