1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
=== tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads2.ts ===
// basic uses of function literals with constructor overloads
class C {
>C : C
constructor(x: string);
>x : string
constructor(x: number);
>x : number
constructor(x) { }
>x : any
}
class D<T> {
>D : D<T>
constructor(x: string);
>x : string
constructor(x: number);
>x : number
constructor(x) { }
>x : any
}
var f: {
>f : { new (x: string): C; new (x: number): C; }
new(x: string): C;
>x : string
new(x: number): C;
>x : number
} = C;
>C : typeof C
var f2: {
>f2 : { new <T>(x: string): C; new <T>(x: number): C; }
new<T>(x: string): C;
>x : string
new<T>(x: number): C;
>x : number
} = C;
>C : typeof C
var f3: {
>f3 : { new <T>(x: string): D<T>; new <T>(x: number): D<T>; }
new<T>(x: string): D<T>;
>x : string
new<T>(x: number): D<T>;
>x : number
} = D;
>D : typeof D
|