Closed

Description
When defining functions through the arrow syntax, the return type is defined in the type, not in the return itself.
The small example isn't the most useful piece of code, but it's mainly an issue when using FunctionComponent
s from react (They're the way forward, so that's only going to be more painful in the future) or any library defining function interfaces really.
const Foo: (n: number) => number = (n) => 2 * n; // This errors but really shouldn't
interface IFoo {
(n: number): number;
}
const Foo: IFoo = n => n * 2; // Same thing, shouldn't error