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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
=== tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithZeroTypeArguments.ts ===
// valid invocations of generic functions with no explicit type arguments provided
function f<T>(x: T): T { return null; }
>f : <T>(x: T) => T
>T : T
>x : T
>T : T
>T : T
>null : null
var r = f(1);
>r : number
>f(1) : 1
>f : <T>(x: T) => T
>1 : 1
var f2 = <T>(x: T): T => { return null; }
>f2 : <T>(x: T) => T
><T>(x: T): T => { return null; } : <T>(x: T) => T
>T : T
>x : T
>T : T
>T : T
>null : null
var r2 = f2(1);
>r2 : number
>f2(1) : 1
>f2 : <T>(x: T) => T
>1 : 1
var f3: { <T>(x: T): T; }
>f3 : <T>(x: T) => T
>T : T
>x : T
>T : T
>T : T
var r3 = f3(1);
>r3 : number
>f3(1) : 1
>f3 : <T>(x: T) => T
>1 : 1
class C {
>C : C
f<T>(x: T): T {
>f : <T>(x: T) => T
>T : T
>x : T
>T : T
>T : T
return null;
>null : null
}
}
var r4 = (new C()).f(1);
>r4 : number
>(new C()).f(1) : 1
>(new C()).f : <T>(x: T) => T
>(new C()) : C
>new C() : C
>C : typeof C
>f : <T>(x: T) => T
>1 : 1
interface I {
>I : I
f<T>(x: T): T;
>f : <T>(x: T) => T
>T : T
>x : T
>T : T
>T : T
}
var i: I;
>i : I
>I : I
var r5 = i.f(1);
>r5 : number
>i.f(1) : 1
>i.f : <T>(x: T) => T
>i : I
>f : <T>(x: T) => T
>1 : 1
class C2<T> {
>C2 : C2<T>
>T : T
f(x: T): T {
>f : (x: T) => T
>x : T
>T : T
>T : T
return null;
>null : null
}
}
var r6 = (new C2()).f(1);
>r6 : {}
>(new C2()).f(1) : {}
>(new C2()).f : (x: {}) => {}
>(new C2()) : C2<{}>
>new C2() : C2<{}>
>C2 : typeof C2
>f : (x: {}) => {}
>1 : 1
interface I2<T> {
>I2 : I2<T>
>T : T
f(x: T): T;
>f : (x: T) => T
>x : T
>T : T
>T : T
}
var i2: I2<number>;
>i2 : I2<number>
>I2 : I2<T>
var r7 = i2.f(1);
>r7 : number
>i2.f(1) : number
>i2.f : (x: number) => number
>i2 : I2<number>
>f : (x: number) => number
>1 : 1
|