I have a situation, where I call a function with some arguments, which are resolved using another function.
This is how the code looks.
function getArgs (): [string, number] {
return ['hello world', 22]
}
function callFnWithArgs (callback) {
callback(...getArgs())
}
callFnWithArgs(function (/* typehint here */) {
})
- The function
callFnWithArgstakes a callback and then execute it by passing some arguments. - Those arguments are given by another function called
getArgs().
So, is there any way to type hint, the arguments of the callback, which is the return value of another function?