2014-10-28 08:28:59 +01:00
tests/cases/compiler/genericRestArgs.ts(2,12): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
2014-10-24 22:51:19 +02:00
Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
2014-09-12 22:35:07 +02:00
tests/cases/compiler/genericRestArgs.ts(5,34): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
2014-10-28 08:28:59 +01:00
tests/cases/compiler/genericRestArgs.ts(10,12): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
2014-10-24 22:51:19 +02:00
Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
2014-09-12 22:35:07 +02:00
tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'.
2014-10-08 22:48:44 +02:00
==== tests/cases/compiler/genericRestArgs.ts (4 errors) ====
2014-07-13 01:04:16 +02:00
function makeArrayG<T>(...items: T[]): T[] { return items; }
var a1Ga = makeArrayG(1, ""); // no error
2014-10-22 00:32:45 +02:00
~~~~~~~~~~
2014-10-28 08:28:59 +01:00
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
2014-10-25 01:42:22 +02:00
!!! error TS2453: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
2014-07-13 01:04:16 +02:00
var a1Gb = makeArrayG<any>(1, "");
var a1Gc = makeArrayG<Object>(1, "");
var a1Gd = makeArrayG<number>(1, ""); // error
2014-07-25 02:00:03 +02:00
~~
2014-09-12 00:19:57 +02:00
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
2014-07-13 01:04:16 +02:00
function makeArrayGOpt<T>(item1?: T, item2?: T, item3?: T) {
return [item1, item2, item3];
}
var a2Ga = makeArrayGOpt(1, "");
2014-10-22 00:32:45 +02:00
~~~~~~~~~~~~~
2014-10-28 08:28:59 +01:00
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
2014-10-25 01:42:22 +02:00
!!! error TS2453: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
2014-07-13 01:04:16 +02:00
var a2Gb = makeArrayG<any>(1, "");
var a2Gc = makeArrayG<any[]>(1, ""); // error
2014-07-25 02:00:03 +02:00
~
2014-09-12 00:19:57 +02:00
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'.