In simple terms, void
is a special type that means nothing is returned from the function which would not work for a function that expects a return value number | undefined
, you can bypass the error by adding a returnat the end of your function:
const foo: Foo = function() {
return;
}