tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral.ts(35,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'E1' is not a valid type argument because it is not a supertype of candidate 'E2'. ==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral.ts (1 errors) ==== interface Computed { read(): T; write(value: T); } function foo(x: Computed) { } var s: string; // Calls below should infer string for T and then assign that type to the value parameter foo({ read: () => s, write: value => s = value }); foo({ write: value => s = value, read: () => s }); enum E1 { X } enum E2 { X } // Check that we infer from both a.r and b before fixing T in a.w declare function f1(a: { w: (x: T) => U; r: () => T; }, b: T): U; var v1: number; var v1 = f1({ w: x => x, r: () => 0 }, 0); var v1 = f1({ w: x => x, r: () => 0 }, E1.X); var v1 = f1({ w: x => x, r: () => E1.X }, 0); var v2: E1; var v2 = f1({ w: x => x, r: () => E1.X }, E1.X); var v3 = f1({ w: x => x, r: () => E1.X }, E2.X); // Error ~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate 'E1' is not a valid type argument because it is not a supertype of candidate 'E2'.