Skip to content

Commit e8f0967

Browse files
wip: fix stack overflow via union-to-tuple
1 parent 00cc73d commit e8f0967

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

source/union-to-tuple.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ const petList = Object.keys(pets) as UnionToTuple<Pet>;
5353
*/
5454
export type UnionToTuple<T, L = LastOfUnion<T>> =
5555
IsNever<T> extends false
56-
? [...UnionToTuple<ExcludeExactly<T, L>>, L]
56+
? UnionToTuple<ExcludeExactly<T, L>> extends infer E extends unknown[]
57+
? [...E, L]
58+
: never
5759
: [];
5860

5961
export {};

0 commit comments

Comments
 (0)