@@ -181,6 +181,46 @@ function f40(c: C) {
181
181
let z : Z = c [ "z" ] ;
182
182
}
183
183
184
+ function f50 < T > ( k : keyof T , s : string , n : number ) {
185
+ const x1 = s as keyof T ;
186
+ const x2 = n as keyof T ;
187
+ const x3 = k as string ;
188
+ const x4 = k as number ;
189
+ const x5 = k as string | number ;
190
+ }
191
+
192
+ function f51 < T , K extends keyof T > ( k : K , s : string , n : number ) {
193
+ const x1 = s as keyof T ;
194
+ const x2 = n as keyof T ;
195
+ const x3 = k as string ;
196
+ const x4 = k as number ;
197
+ const x5 = k as string | number ;
198
+ }
199
+
200
+ function f52 < T > ( obj : { [ x : string ] : boolean } , k : keyof T , s : string , n : number ) {
201
+ const x1 = obj [ s ] ;
202
+ const x2 = obj [ n ] ;
203
+ const x3 = obj [ k ] ;
204
+ }
205
+
206
+ function f53 < T , K extends keyof T > ( obj : { [ x : string ] : boolean } , k : K , s : string , n : number ) {
207
+ const x1 = obj [ s ] ;
208
+ const x2 = obj [ n ] ;
209
+ const x3 = obj [ k ] ;
210
+ }
211
+
212
+ function f54 < T > ( obj : T , key : keyof T ) {
213
+ for ( let s in obj [ key ] ) {
214
+ }
215
+ const b = "foo" in obj [ key ] ;
216
+ }
217
+
218
+ function f55 < T , K extends keyof T > ( obj : T , key : K ) {
219
+ for ( let s in obj [ key ] ) {
220
+ }
221
+ const b = "foo" in obj [ key ] ;
222
+ }
223
+
184
224
// Repros from #12011
185
225
186
226
class Base {
0 commit comments