Given the following overloaded function:
foo(tool: 'a', poaram: boolean, poarama: number): boolean
foo(tool: 'b', paramo: string, paramoa: string): boolean
foo(tool: 'a' | 'b', ...args: any[]): boolean {
if (tool === 'a') {
const [ poaram, poarama ] = args
}
return false
}
Is there any way to have poaram and poarama not be typed as any but as boolean and number respectively?
I am aware of Tuples in rest parameters and spread expressions, but I fail to see the connection to my use case above.