TypeScript Version: 3.1.0-dev.20180730
Code
type Rec = {
foo: (a: string, b: number) => void,
bar: (b: boolean, c: RegExp) => void,
}
type Parameters<T> = T extends (...args: infer U) => any ? U : never;
declare var fn: <K extends keyof Rec>(e: K, ...args: Parameters<Rec[K]>) => void;
fn('foo', /* get parameter help here */);
Expected behavior:
Since I've provided 'foo', the only acceptable parameters to follow are a: string, b: number.
Actual behavior:
Parameter help shows me the union of all possible types for ...args including ones that will give me a type error if I use them.
TypeScript Version: 3.1.0-dev.20180730
Code
Expected behavior:
Since I've provided
'foo', the only acceptable parameters to follow are a: string, b: number.Actual behavior:
Parameter help shows me the union of all possible types for
...argsincluding ones that will give me a type error if I use them.