mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-04 16:55:03 -05:00
* Initial * Calendar initial * Extract EventCalendar * Events list initial * Winners * SQL fixes * List events by series * Leaderboards * Series leaderboard * Own entry peek * Edit page skeleton * RHF initial test * RHF stuff * Form etc. progress * Fix tournament series description * Fix tabs layout * Fix socials insert * Check for not removing admin * Adding series * TODOs * Allow updating org with no series * FormFieldset * Allow series without events * TextAreaFormfield accepting array syntax * Input form array field * ToggleFormField * SelectFormField * UserSearchFormField * Fetch badgeOptions * Badge editing * Progress * Use native preventScrollReset * Rename func * Fix sticky scroll * Fix translation * i18n errors * handle,meta in edit * Add ref to user search * TODOs * Done
28 lines
713 B
TypeScript
28 lines
713 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>>
|
|
>;
|
|
|
|
export type UnwrappedNonNullable<T extends (...args: any) => any> = NonNullable<
|
|
Unwrapped<T>
|
|
>;
|