Closed
Description
This code used to compile without error under 1.0:
module M {
export interface T<A> {
get(): A;
}
export function ap<A, B>(f: T<(a: A) => B>, x: T<A>): T<B> {
return {
get: () => f.get()(x.get())
};
}
export function map<A, B>(f: (a: A) => B, x: T<A>): T<B> {
return {
get: () => f(x.get())
};
}
var x: T<number> = {
get: () => 0
};
var test = ap(ap(map((a: number) => (b: number) => (c: number) => {
return { a: a, b: b, c: c };
}, x), x), x);
}
However, under 1.1, I get the following error:
(23,37): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
I don't see any reason why any subexpression of test
should have an inferred type of any
.