2014-09-12 22:35:07 +02:00
tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(16,32): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
2015-01-20 23:18:22 +01:00
Type 'string' is not assignable to type 'Date'.
2015-03-26 03:23:44 +01:00
Property 'toDateString' is missing in type 'String'.
2014-09-12 22:35:07 +02:00
tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(17,32): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => 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/contextualTypingOfGenericFunctionTypedArguments1.ts (2 errors) ====
interface Collection<T> {
length: number;
add(x: T): void;
remove(x: T): boolean;
}
interface Combinators {
forEach<T>(c: Collection<T>, f: (x: T) => Date): void;
}
var c2: Collection<number>;
var _: Combinators;
// errors on all 3 lines, bug was that r5 was the only line with errors
var f = (x: number) => { return x.toFixed() };
var r5 = _.forEach<number>(c2, f);
2014-07-25 02:00:03 +02:00
~
2014-09-12 00:19:57 +02:00
!!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
2015-01-20 23:18:22 +01:00
!!! error TS2345: Type 'string' is not assignable to type 'Date'.
2015-03-26 03:23:44 +01:00
!!! error TS2345: Property 'toDateString' is missing in type 'String'.
2014-07-13 01:04:16 +02:00
var r6 = _.forEach<number>(c2, (x) => { 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) => string' is not assignable to parameter of type '(x: number) => 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