-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
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
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue