Currently, I am diving into the world of TypeScript and finding myself puzzled by the distinction between the keyword function and => (fat arrow). Take a look at the code snippet below:
interface Counter {
(start: number);
interval: number;
reset(): void;
}
let a = <Counter>function(start: number) { };
let b = <Counter>(start: number) => { };
a.reset(); //OK
b.reset(); //error: Property 'reset' does not exist on type <Counter>(start: number) => void
It appears that fat arrow behaves differently compared to the traditional keyword function in TypeScript.