Imagine having a high order function that returns another function:
function factory() {
return function baz(payload: { [key: string]: {} }): 'hello' {
return 'hello';
}
}
const foo = factory();
Now, foo
is the function baz
with a generic argument signature:
interface payload {
[key: string] : {}
}
The goal is to overload this signature for foo
only to make it more precise:
function foo(payload: {id: string}) {}
How can I accomplish this?