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 {
|
2015-04-16 01:44:20 +02:00
|
|
|
>C : C
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
constructor(x: string);
|
2015-04-16 01:44:20 +02:00
|
|
|
>x : string
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
constructor(x: number);
|
2015-04-16 01:44:20 +02:00
|
|
|
>x : number
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
constructor(x) { }
|
2015-04-16 01:44:20 +02:00
|
|
|
>x : any
|
2014-08-15 23:33:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
class D<T> {
|
2015-04-16 01:44:20 +02:00
|
|
|
>D : D<T>
|
|
|
|
>T : T
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
constructor(x: string);
|
2015-04-16 01:44:20 +02:00
|
|
|
>x : string
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
constructor(x: number);
|
2015-04-16 01:44:20 +02:00
|
|
|
>x : number
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
constructor(x) { }
|
2015-04-16 01:44:20 +02:00
|
|
|
>x : any
|
2014-08-15 23:33:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var f: {
|
2015-04-16 01:44:20 +02:00
|
|
|
>f : { new (x: string): C; new (x: number): C; }
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
new(x: string): C;
|
2015-04-16 01:44:20 +02:00
|
|
|
>x : string
|
|
|
|
>C : C
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
new(x: number): C;
|
2015-04-16 01:44:20 +02:00
|
|
|
>x : number
|
|
|
|
>C : C
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
} = C;
|
2015-04-16 01:44:20 +02:00
|
|
|
>C : typeof C
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var f2: {
|
2015-04-16 01:44:20 +02:00
|
|
|
>f2 : { new <T>(x: string): C; new <T>(x: number): C; }
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
new<T>(x: string): C;
|
2015-04-16 01:44:20 +02:00
|
|
|
>T : T
|
|
|
|
>x : string
|
|
|
|
>C : C
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
new<T>(x: number): C;
|
2015-04-16 01:44:20 +02:00
|
|
|
>T : T
|
|
|
|
>x : number
|
|
|
|
>C : C
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
} = C;
|
2015-04-16 01:44:20 +02:00
|
|
|
>C : typeof C
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var f3: {
|
2015-04-16 01:44:20 +02:00
|
|
|
>f3 : { new <T>(x: string): D<T>; new <T>(x: number): D<T>; }
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
new<T>(x: string): D<T>;
|
2015-04-16 01:44:20 +02:00
|
|
|
>T : T
|
|
|
|
>x : string
|
|
|
|
>D : D<T>
|
|
|
|
>T : T
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
new<T>(x: number): D<T>;
|
2015-04-16 01:44:20 +02:00
|
|
|
>T : T
|
|
|
|
>x : number
|
|
|
|
>D : D<T>
|
|
|
|
>T : T
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
} = D;
|
2015-04-16 01:44:20 +02:00
|
|
|
>D : typeof D
|
2014-08-15 23:33:16 +02:00
|
|
|
|