Created
November 22, 2023 01:48
-
-
Save forivall/545b35e8ad4d2bbf66af12f8666406de to your computer and use it in GitHub Desktop.
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
// limit to 9 entries in the union, otherwise type instantiation gets very deep | |
export type ConstArrayOf<T, T2 = T> = [T] extends [never] | |
? [] | |
: T extends infer U | |
? [U, ...ConstArrayOf<Exclude<T2, U>>] | |
: never; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment