TypeScript/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt
2014-07-24 19:39:50 -07:00

18 lines
919 B
Plaintext

==== 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
~~~~~~~
!!! Argument of type '{}[]' is not assignable to parameter of type 'number[]'.
!!! Type '{}' is not assignable to type 'number'.
var r7b = map<number>([1, ""], (x) => x.toString()); // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Supplied parameters do not match any signature of call target.
var r8 = map<any, string>([1, ""], (x) => x.toString());