Skip to content

Commit 710826e

Browse files
committed
Add regression test
1 parent 36be6c8 commit 710826e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,17 @@ declare function take(cb: (a: number, b: string) => void): void;
7070

7171
(function foo(...rest){}(1, ''));
7272
take(function(...rest){});
73+
74+
// Repro from #29833
75+
76+
type ArgsUnion = [number, string] | [number, Error];
77+
type TupleUnionFunc = (...params: ArgsUnion) => number;
78+
79+
const funcUnionTupleNoRest: TupleUnionFunc = (num, strOrErr) => {
80+
return num;
81+
};
82+
83+
const funcUnionTupleRest: TupleUnionFunc = (...params) => {
84+
const [num, strOrErr] = params;
85+
return num;
86+
};

0 commit comments

Comments
 (0)