Closed
Description
TypeScript Version: 3.1.0-dev.20180719
Code
type R = {
a: (x: number) => void;
b: (x: string) => void;
};
type O = {
on<P extends keyof R>(x: P, callback: R[P]): void;
};
declare var x: O;
x.on('a', a => {}); // not contextually typed.
Expected behavior:
Contextually type a to number.
Actual behavior:
A is not contextually typed, while signature help gives the correct answer.
Playground Link: here