2014-10-18 01:53:18 +02:00
tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(10,30): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'.
2014-10-28 08:28:59 +01:00
Type 'string | number' is not assignable to type 'number'.
2014-10-08 22:48:44 +02:00
Type 'string' is not assignable to type 'number'.
2014-09-12 22:35:07 +02:00
tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,11): error TS2346: Supplied parameters do not match any signature of call target.
2014-07-13 01:04:16 +02:00
==== tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts (2 errors) ====
function map<T, U>(xs: T[], f: (x: T) => U) {
var ys: U[] = [];
xs.forEach(x => ys.push(f(x)));
return ys;
}
var r0 = map([1, ""], (x) => x.toString());
var r5 = map<any, any>([1, ""], (x) => x.toString());
var r6 = map<Object, Object>([1, ""], (x) => x.toString());
var r7 = map<number, string>([1, ""], (x) => x.toString()); // error
2014-07-25 02:00:03 +02:00
~~~~~~~
2014-10-18 01:53:18 +02:00
!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'.
2014-10-28 08:28:59 +01:00
!!! error TS2345: Type 'string | number' is not assignable to type 'number'.
2014-10-08 22:48:44 +02:00
!!! error TS2345: Type 'string' is not assignable to type 'number'.
2014-07-13 01:04:16 +02:00
var r7b = map<number>([1, ""], (x) => x.toString()); // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2014-09-12 00:19:57 +02:00
!!! error TS2346: Supplied parameters do not match any signature of call target.
2014-07-13 01:04:16 +02:00
var r8 = map<any, string>([1, ""], (x) => x.toString());