Closed
Description
Bug Report
π Search Terms
function, method, generic, parameters, does not satisfy constraint, 4.5
π Version & Regression Information
- This changed between versions 4.4.4 and 4.5.0
β― Playground Link
Playground link with relevant code
βπΌ Switch the version to v4.4.4 and this compiles fine; v4.5.0-beta errors (as does v4.5.2, but the Playground doesn't offer this version)
π» Code
type Methods<T> = {
[K in keyof T]: T[K] extends Function ? K : never;
}[keyof T];
class Test {
foo = '';
bar(a: string, b: number): void {}
}
function doSomeProxying<
T,
Method extends Methods<T>,
Args extends Parameters<T[Method]>,
>(
type: T,
method: Method,
...args: Args
): void {}
doSomeProxying(new Test(), 'bar', 'arg', 123);
π Actual behavior
Compiler errors in v4.5.0, even though it was fine in v4.4.4.
π Expected behavior
Expect to be able to use the built-in Parameters<>
type on properties I have narrowed down as functions.