2014-10-22 23:49:23 +02:00
tests/cases/compiler/typeArgInference2.ts(12,10): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly.
2014-10-10 23:41:14 +02:00
==== tests/cases/compiler/typeArgInference2.ts (1 errors) ====
interface Item {
name: string;
}
declare function foo<T extends Item>(x?: T, y?: T): T;
var z1 = foo(null); // any
var z2 = foo(); // Item
var z3 = foo({ name: null }); // { name: any }
var z4 = foo({ name: "abc" }); // { name: string }
var z5 = foo({ name: "abc", a: 5 }); // { name: string; a: number }
var z6 = foo({ name: "abc", a: 5 }, { name: "def", b: 5 }); // error
2014-10-22 00:32:45 +02:00
~~~
2014-10-22 23:49:23 +02:00
!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly.