Skip to content

Instantly share code, notes, and snippets.

@raganwald
Last active May 8, 2025 17:17
Show Gist options
  • Save raganwald/5abdf935ee0b963e81cf2931902c41db to your computer and use it in GitHub Desktop.
Save raganwald/5abdf935ee0b963e81cf2931902c41db to your computer and use it in GitHub Desktop.
TypeScript Handy Dandies
type Expect<T extends true> = T;
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2
? true
: false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment