Skip to content

Instantly share code, notes, and snippets.

@cefn
Created September 29, 2022 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cefn/784a6384f51de364de9edcfb53cc8f47 to your computer and use it in GitHub Desktop.
Save cefn/784a6384f51de364de9edcfb53cc8f47 to your computer and use it in GitHub Desktop.
Typescript - derive index of tuple from tuple type
type IndexOf<T extends {length: number}> = Exclude<Partial<T>["length"], T['length']> & number;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment