Created
January 13, 2024 15:37
-
-
Save timvandam/d45827dd01c8684d53771647c7783bfb to your computer and use it in GitHub Desktop.
TypeScript union permutations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Permutations<T, O = T> = [T] extends [never] ? [] : T extends any ? [T, ...Permutations<Exclude<O, T>>] : never; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment