I want to define a function which takes a callback as a parameter, and that callback's parameters should be required. Typescript correctly reports a callback with a mismatched parameter type but says nothing about callbacks with no expected arguments.
Why does the second on call not error, and is there any way to make it error?
function on(callback: (num: number) => void) {
callback(5);
}
on((string:bob) => { // typescript error
console.log("What");
});
on(() => { // no typescript error?
console.log("What");
});