mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 06:36:08 +03:00
28 lines
457 B
TypeScript
28 lines
457 B
TypeScript
// basic uses of function literals with constructor overloads
|
|
|
|
class C {
|
|
constructor(x: string);
|
|
constructor(x: number);
|
|
constructor(x) { }
|
|
}
|
|
|
|
class D<T> {
|
|
constructor(x: string);
|
|
constructor(x: number);
|
|
constructor(x) { }
|
|
}
|
|
|
|
var f: {
|
|
new(x: string): C;
|
|
new(x: number): C;
|
|
} = C;
|
|
|
|
var f2: {
|
|
new<T>(x: string): C;
|
|
new<T>(x: number): C;
|
|
} = C;
|
|
|
|
var f3: {
|
|
new<T>(x: string): D<T>;
|
|
new<T>(x: number): D<T>;
|
|
} = D; |