Contextual type of dependent parameter

Viewed 71

Is it possible to get contextual typing for function parameters, when overloading with a union?

declare function f(...args: [x: 'a', y: (a: string) => void] | [x: 'b', y: (a: boolean) => void]): void;

// Parameter 'x' implicitly has an 'any' type.(7006)
f('a', x => {});

declare function g(x: 'a', y: (a: string) => void): void;
declare function g(x: 'b', y: (a: boolean) => void): void;

// Ok.
g('a', x => {});

Playground link

Especially after the work for dependent parameters, i thought it would work? Is there an open issue to track this?

0 Answers
Related