typedash
Version:
modern, type-safe collection of utility functions
17 lines • 678 B
text/typescript
//#region src/functions/assertNever/assertNever.d.ts
/**
* 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;
//#endregion
export { assertNever as t };
//# sourceMappingURL=assertNever-DfRuj4hK.d.cts.map