2014-08-15 23:33:16 +02:00
|
|
|
=== 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>
|
|
|
|
>T : 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
|
|
|
|
>C : C
|
|
|
|
|
|
|
|
new(x: number): C;
|
|
|
|
>x : number
|
|
|
|
>C : C
|
|
|
|
|
|
|
|
} = C;
|
|
|
|
>C : typeof C
|
|
|
|
|
|
|
|
var f2: {
|
|
|
|
>f2 : { new <T>(x: string): C; new <T>(x: number): C; }
|
|
|
|
|
|
|
|
new<T>(x: string): C;
|
|
|
|
>T : T
|
|
|
|
>x : string
|
|
|
|
>C : C
|
|
|
|
|
|
|
|
new<T>(x: number): C;
|
|
|
|
>T : T
|
|
|
|
>x : number
|
|
|
|
>C : C
|
|
|
|
|
|
|
|
} = 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>;
|
|
|
|
>T : T
|
|
|
|
>x : string
|
2014-08-19 04:56:03 +02:00
|
|
|
>D : D<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
new<T>(x: number): D<T>;
|
|
|
|
>T : T
|
|
|
|
>x : number
|
2014-08-19 04:56:03 +02:00
|
|
|
>D : D<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
} = D;
|
|
|
|
>D : typeof D
|
|
|
|
|