Skip to content

Instantly share code, notes, and snippets.

@zwhitchcox
Created May 14, 2024 16:30
Show Gist options
  • Save zwhitchcox/683de781f57a8c9fd5d1891db9d6cd3b to your computer and use it in GitHub Desktop.
Save zwhitchcox/683de781f57a8c9fd5d1891db9d6cd3b to your computer and use it in GitHub Desktop.
Type Examples
type CombineTuples<T extends [[number] | number[]] | ([number] | number[])[]> =
T extends [infer A, ...infer B]
? A extends number[] | [number]
? B extends [number[] | [number]] | ([number] | number[])[]
? [...A, ...CombineTuples<B>]
: never
: never
: []
type J = CombineTuples<[[1, 2, 3], [4, 5, 6]]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment