Skip to content

Instantly share code, notes, and snippets.

@anztrax
Created November 30, 2025 00:13
Show Gist options
  • Select an option

  • Save anztrax/ce97c82d667888a34a3b669bb86bab4c to your computer and use it in GitHub Desktop.

Select an option

Save anztrax/ce97c82d667888a34a3b669bb86bab4c to your computer and use it in GitHub Desktop.
Simple Implemention Tuple to Object
// this version using any
type TupleToObject<T extends readonly (keyof any)[]> = {
[A in T[number]]: A
}
// this version not using any, use PropertyKey instead
type TupleToObject<T extends readonly PropertyKey[]> = {
[A in T[number]]: A
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment