|
| 1 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(5,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 2 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(9,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 3 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(13,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 4 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(16,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 5 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(20,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 6 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(23,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 7 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(27,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 8 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(28,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 9 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(29,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 10 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(33,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 11 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(34,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 12 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(35,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 13 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(39,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 14 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(40,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 15 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(41,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 16 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(45,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 17 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(46,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 18 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(47,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 19 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(51,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 20 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(52,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 21 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(53,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 22 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(57,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 23 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(58,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 24 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(64,11): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 25 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,11): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 26 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(81,11): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 27 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(86,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 28 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(90,11): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 29 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(64,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. |
| 30 | + Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. |
| 31 | +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. |
| 32 | + Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. |
| 33 | + |
| 34 | + |
| 35 | +==== tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts (30 errors) ==== |
| 36 | + |
| 37 | + |
| 38 | + // Generic tag with one parameter |
| 39 | + function noParams<T>(n: T) { } |
| 40 | + noParams ``; |
| 41 | + ~~~~~~~~~~~ |
| 42 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 43 | + |
| 44 | + // Generic tag with parameter which does not use type parameter |
| 45 | + function noGenericParams<T>(n: string[]) { } |
| 46 | + noGenericParams ``; |
| 47 | + ~~~~~~~~~~~~~~~~~~ |
| 48 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 49 | + |
| 50 | + // Generic tag with multiple type parameters and only one used in parameter type annotation |
| 51 | + function someGenerics1a<T, U>(n: T, m: number) { } |
| 52 | + someGenerics1a `${3}`; |
| 53 | + ~~~~~~~~~~~~~~~~~~~~~ |
| 54 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 55 | + |
| 56 | + function someGenerics1b<T, U>(n: string[], m: U) { } |
| 57 | + someGenerics1b `${3}`; |
| 58 | + ~~~~~~~~~~~~~~~~~~~~~ |
| 59 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 60 | + |
| 61 | + // Generic tag with argument of function type whose parameter is of type parameter type |
| 62 | + function someGenerics2a<T>(strs: string[], n: (x: T) => void) { } |
| 63 | + someGenerics2a `${(n: string) => n}`; |
| 64 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 65 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 66 | + |
| 67 | + function someGenerics2b<T, U>(strs: string[], n: (x: T, y: U) => void) { } |
| 68 | + someGenerics2b `${ (n: string, x: number) => n }`; |
| 69 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 70 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 71 | + |
| 72 | + // Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter |
| 73 | + function someGenerics3<T>(strs: string[], producer: () => T) { } |
| 74 | + someGenerics3 `${() => ''}`; |
| 75 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 76 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 77 | + someGenerics3 `${() => undefined}`; |
| 78 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 79 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 80 | + someGenerics3 `${() => 3}`; |
| 81 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 82 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 83 | + |
| 84 | + // 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type |
| 85 | + function someGenerics4<T, U>(strs: string[], n: T, f: (x: U) => void) { } |
| 86 | + someGenerics4 `${4}${ () => null }`; |
| 87 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 88 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 89 | + someGenerics4 `${''}${ () => 3 }`; |
| 90 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 91 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 92 | + someGenerics4 `${ null }${ null }`; |
| 93 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 94 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 95 | + |
| 96 | + // 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type |
| 97 | + function someGenerics5<U, T>(strs: string[], n: T, f: (x: U) => void) { } |
| 98 | + someGenerics5 `${ 4 } ${ () => null }`; |
| 99 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 100 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 101 | + someGenerics5 `${ '' }${ () => 3 }`; |
| 102 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 103 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 104 | + someGenerics5 `${null}${null}`; |
| 105 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 106 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 107 | + |
| 108 | + // Generic tag with multiple arguments of function types that each have parameters of the same generic type |
| 109 | + function someGenerics6<A>(strs: string[], a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { } |
| 110 | + someGenerics6 `${ n => n }${ n => n}${ n => n}`; |
| 111 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 112 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 113 | + someGenerics6 `${ n => n }${ n => n}${ n => n}`; |
| 114 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 115 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 116 | + someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }`; |
| 117 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 118 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 119 | + |
| 120 | + // Generic tag with multiple arguments of function types that each have parameters of different generic type |
| 121 | + function someGenerics7<A, B, C>(strs: string[], a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { } |
| 122 | + someGenerics7 `${ n => n }${ n => n }${ n => n }`; |
| 123 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 124 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 125 | + someGenerics7 `${ n => n }${ n => n }${ n => n }`; |
| 126 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 127 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 128 | + someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}`; |
| 129 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 130 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 131 | + |
| 132 | + // Generic tag with argument of generic function type |
| 133 | + function someGenerics8<T>(strs: string[], n: T): T { return n; } |
| 134 | + var x = someGenerics8 `${ someGenerics7 }`; |
| 135 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 136 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 137 | + x `${null}${null}${null}`; |
| 138 | + ~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 139 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 140 | + |
| 141 | + // Generic tag with multiple parameters of generic type passed arguments with no best common type |
| 142 | + function someGenerics9<T>(strs: string[], a: T, b: T, c: T): T { |
| 143 | + return null; |
| 144 | + } |
| 145 | + var a9a = someGenerics9 `${ '' }${ 0 }${ [] }`; |
| 146 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 147 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 148 | + ~~~~~~~~~~~~~ |
| 149 | +!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. |
| 150 | +!!! error TS2453: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. |
| 151 | + var a9a: {}; |
| 152 | + |
| 153 | + // Generic tag with multiple parameters of generic type passed arguments with multiple best common types |
| 154 | + interface A91 { |
| 155 | + x: number; |
| 156 | + y?: string; |
| 157 | + } |
| 158 | + interface A92 { |
| 159 | + x: number; |
| 160 | + z?: Date; |
| 161 | + } |
| 162 | + |
| 163 | + var a9e = someGenerics9 `${ undefined }${ { x: 6, z: new Date() } }${ { x: 6, y: '' } }`; |
| 164 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 165 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 166 | + ~~~~~~~~~~~~~ |
| 167 | +!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. |
| 168 | +!!! error TS2453: Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. |
| 169 | + var a9e: {}; |
| 170 | + |
| 171 | + // Generic tag with multiple parameters of generic type passed arguments with a single best common type |
| 172 | + var a9d = someGenerics9 `${ { x: 3 }}${ { x: 6 }}${ { x: 6 } }`; |
| 173 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 174 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 175 | + var a9d: { x: number; }; |
| 176 | + |
| 177 | + // Generic tag with multiple parameters of generic type where one argument is of type 'any' |
| 178 | + var anyVar: any; |
| 179 | + var a = someGenerics9 `${ 7 }${ anyVar }${ 4 }`; |
| 180 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 181 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 182 | + var a: any; |
| 183 | + |
| 184 | + // Generic tag with multiple parameters of generic type where one argument is [] and the other is not 'any' |
| 185 | + var arr = someGenerics9 `${ [] }${ null }${ undefined }`; |
| 186 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 187 | +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. |
| 188 | + var arr: any[]; |
| 189 | + |
| 190 | + |
0 commit comments