Are strongly-typed functions as parameters possible in TypeScript?
Sure. A function’s type consists of the types of its argument and its return type. Here we specify that the callback parameter’s type must be “function that accepts a number and returns type any“: class Foo { save(callback: (n: number) => any) : void { callback(42); } } var foo = new Foo(); var strCallback … Read more