All files / utils/common exhaustive-check.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                                                38x  
/**
 * Exhaustive check to ensure all cases are handled.
 *
 * Typically used in switch statements to ensure all cases are handled at compile time.
 *
 * @example
 *
 * ```ts
 * type Fruit = 'apple' | 'banana' | 'orange';
 * const fruit: Fruit = 'apple';
 * switch (fruit) {
 *   case 'apple':
 *     return '🍎';
 *   case 'banana':
 *     return '🍌';
 *   case 'orange':
 *     return '🍊';
 *   default:
 *     exhaustiveCheck(fruit);
 * }
 * ```
 *
 * @param _ - The never-used parameter.
 */
export const exhaustiveCheck = (_: never) => void 0;