mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-21 19:06:38 -05:00
* Initial * CSS lint * Test CI * Add 1v1, 2v2, and 3v3 Tags (#1771) * Initial * CSS lint * Test CI * Rename step --------- Co-authored-by: xi <104683822+ximk@users.noreply.github.com>
24 lines
614 B
TypeScript
24 lines
614 B
TypeScript
export function assertUnreachable(x: never): never {
|
|
throw new Error(
|
|
`Didn't expect to get here. Unexpected value: ${JSON.stringify(x)}`,
|
|
);
|
|
}
|
|
|
|
/** @link https://stackoverflow.com/a/69413184 */
|
|
// @ts-expect-error helper to assert type to be another compile time
|
|
export const assertType = <A, B extends A>() => {};
|
|
|
|
export type Unpacked<T> = T extends (infer U)[]
|
|
? U
|
|
: T extends (...args: unknown[]) => infer U
|
|
? U
|
|
: T extends Promise<infer U>
|
|
? U
|
|
: T;
|
|
|
|
export type Nullish<T> = T | null | undefined;
|
|
|
|
export type Unwrapped<T extends (...args: any) => any> = Unpacked<
|
|
Awaited<ReturnType<T>>
|
|
>;
|