Error with callback example and "noImplicitAny: true"

Topics: Language Specification
Jul 21, 2015 at 8:57 AM
Hi, I'm currently writing a definition file for a project and ran into some issues when i wanted to write the callbacks, with the correct parameter hinting and such.

The example page states:
addLater(3, 4, (x) => console.log('x = ' + x));

// Note: 'void' return type is preferred here
function addLater(x: number, y: number, (sum: number) => void): void;
Though, the compiler says:
(12,41): error TS1138: Parameter declaration expected.
(12,62): error TS1109: Expression expected.
(12,63): error TS1128: Declaration or statement expected.
(12,69): error TS1109: Expression expected.
row 12 is the row in questions. I've also seen it complain about the type any being returned, but as i can see, void will be returned instead.

Any idea what's up?