Bug Report
π Search Terms
arguments, generics, inference, two or more, variance
π Version & Regression Information
- This changed between versions 4.7 and 4.8+ (stopped working on 4.8+)
β― Playground Link
Playground link with relevant code
π» Code
declare type Callback<Args extends any[], Out, R> = (...args: Args) => (data: Out) => R;
declare function factory<Out>(): <Args extends any[], R>(callback: Callback<Args, Out, R>) => (...args: Args) => R;
const make = factory<{id: string, age: number}[]>();
// Errors here
const usersOverAge = make((age: number) => data => {
return data.filter(user => user.age >= age);
});
π Actual behavior
The code errors with a function not being assignable to a signature, and generics not being inferred correctly.
π Expected behavior
The function definition is passed as expected and generics are correctly inferred
Bug Report
π Search Terms
arguments, generics, inference, two or more, variance
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
The code errors with a function not being assignable to a signature, and generics not being inferred correctly.
π Expected behavior
The function definition is passed as expected and generics are correctly inferred