Skip to content

Commit 4bd9b62

Browse files
committed
Add regression tests
1 parent c02fdaa commit 4bd9b62

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// @strict: true
2+
3+
// Repros from #32976
4+
5+
declare class Banana<T extends string> { constructor(a: string, property: T) }
6+
7+
declare function fruitFactory1<TFruit>(Fruit: new (...args: any[]) => TFruit): TFruit
8+
const banana1 = fruitFactory1(Banana) // Banana<any>
9+
10+
declare function fruitFactory2<TFruit>(Fruit: new (a: string, ...args: any[]) => TFruit): TFruit
11+
const banana2 = fruitFactory2(Banana) // Banana<any>
12+
13+
declare function fruitFactory3<TFruit>(Fruit: new (a: string, s: "foo", ...args: any[]) => TFruit): TFruit
14+
const banana3 = fruitFactory3(Banana) // Banana<"foo">
15+
16+
declare function fruitFactory4<TFruit>(Fruit: new (a: string, ...args: "foo"[]) => TFruit): TFruit
17+
const banana4 = fruitFactory4(Banana) // Banana<"foo">
18+
19+
declare function fruitFactory5<TFruit>(Fruit: new (...args: "foo"[]) => TFruit): TFruit
20+
const banana5 = fruitFactory5(Banana) // Banana<"foo">

0 commit comments

Comments
 (0)