=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndStringIndexer.ts === // Type inference infers from indexers in target type, no errors expected function foo(x: T) { >foo : (x: T) => T, Symbol(foo, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 0, 0)) >T : T, Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 2, 13)) >x : T, Symbol(x, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 2, 16)) >T : T, Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 2, 13)) return x; >x : T, Symbol(x, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 2, 16)) } var a: { [x: string]: Date }; >a : { [x: string]: Date; }, Symbol(a, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 6, 3)) >x : string, Symbol(x, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 6, 10)) >Date : Date, Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11)) var r = foo(a); >r : { [x: string]: Date; }, Symbol(r, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 7, 3)) >foo(a) : { [x: string]: Date; } >foo : (x: T) => T, Symbol(foo, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 0, 0)) >a : { [x: string]: Date; }, Symbol(a, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 6, 3)) function other(arg: T) { >other : (arg: T) => void, Symbol(other, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 7, 15)) >T : T, Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 9, 15)) >arg : T, Symbol(arg, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 9, 18)) >T : T, Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 9, 15)) var b: { [x: string]: T }; >b : { [x: string]: T; }, Symbol(b, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 10, 7)) >x : string, Symbol(x, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 10, 14)) >T : T, Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 9, 15)) var r2 = foo(b); // T >r2 : { [x: string]: T; }, Symbol(r2, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 11, 7)) >foo(b) : { [x: string]: T; } >foo : (x: T) => T, Symbol(foo, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 0, 0)) >b : { [x: string]: T; }, Symbol(b, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 10, 7)) } function other2(arg: T) { >other2 : (arg: T) => void, Symbol(other2, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 12, 1)) >T : T, Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 14, 16)) >Date : Date, Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11)) >arg : T, Symbol(arg, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 14, 32)) >T : T, Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 14, 16)) var b: { [x: string]: T }; >b : { [x: string]: T; }, Symbol(b, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 15, 7)) >x : string, Symbol(x, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 15, 14)) >T : T, Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 14, 16)) var r2 = foo(b); >r2 : { [x: string]: T; }, Symbol(r2, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 16, 7)) >foo(b) : { [x: string]: T; } >foo : (x: T) => T, Symbol(foo, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 0, 0)) >b : { [x: string]: T; }, Symbol(b, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 15, 7)) var d: Date = r2['hm']; // ok >d : Date, Symbol(d, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 17, 7)) >Date : Date, Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11)) >r2['hm'] : T >r2 : { [x: string]: T; }, Symbol(r2, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 16, 7)) >'hm' : string } function other3(arg: T) { >other3 : (arg: T) => void, Symbol(other3, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 18, 1)) >T : T, Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 20, 16)) >Date : Date, Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11)) >U : U, Symbol(U, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 20, 31)) >Date : Date, Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11)) >arg : T, Symbol(arg, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 20, 48)) >T : T, Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 20, 16)) var b: { [x: string]: T }; >b : { [x: string]: T; }, Symbol(b, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 21, 7)) >x : string, Symbol(x, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 21, 14)) >T : T, Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 20, 16)) var r2 = foo(b); >r2 : { [x: string]: T; }, Symbol(r2, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 22, 7)) >foo(b) : { [x: string]: T; } >foo : (x: T) => T, Symbol(foo, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 0, 0)) >b : { [x: string]: T; }, Symbol(b, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 21, 7)) var d: Date = r2['hm']; // ok >d : Date, Symbol(d, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 23, 7)) >Date : Date, Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11)) >r2['hm'] : T >r2 : { [x: string]: T; }, Symbol(r2, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 22, 7)) >'hm' : string // BUG 821629 //var u: U = r2['hm']; // ok } //function other3(arg: T) { // var b: { [x: string]: T }; // var r2 = foo(b); // var d: Date = r2['hm']; // ok // // BUG 821629 // //var u: U = r2['hm']; // ok //}