2014-09-12 22:35:07 +02:00
tests/cases/compiler/genericCombinators2.ts(15,43): error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
2015-01-20 23:18:22 +01:00
Type 'string' is not assignable to type 'Date'.
2014-09-12 22:35:07 +02:00
tests/cases/compiler/genericCombinators2.ts(16,43): error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
2015-01-20 23:18:22 +01:00
Type 'string' is not assignable to type 'Date'.
2014-09-12 22:35:07 +02:00
2014-07-13 01:04:16 +02:00
==== tests/cases/compiler/genericCombinators2.ts (2 errors) ====
interface Collection<T, U> {
length: number;
add(x: T, y: U): void;
remove(x: T, y: U): boolean;
}
interface Combinators {
map<T, U>(c: Collection<T, U>, f: (x: T, y: U) => any): Collection<any, any>;
map<T, U, V>(c: Collection<T, U>, f: (x: T, y: U) => V): Collection<T, V>;
}
var _: Combinators;
var c2: Collection<number, string>;
var rf1 = (x: number, y: string) => { return x.toFixed() };
var r5a = _.map<number, string, Date>(c2, (x, y) => { return x.toFixed() });
2014-07-25 02:00:03 +02:00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2014-09-12 00:19:57 +02:00
!!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
2015-01-20 23:18:22 +01:00
!!! error TS2345: Type 'string' is not assignable to type 'Date'.
2014-07-13 01:04:16 +02:00
var r5b = _.map<number, string, Date>(c2, rf1);
2014-07-25 02:00:03 +02:00
~~~
2015-01-20 23:18:22 +01:00
!!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
!!! error TS2345: Type 'string' is not assignable to type 'Date'.