-
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
- extends
- contain
- constraint
π Version & Regression Information
4.3.0-dev.20210407
This was working in the TS 4.3 beta
β― Playground Link
π» Code
export type AddFirstParameterToFunctions<Target> = {
[K in keyof Target]: Target[K] extends (...args: any[]) => void
? (...args: Parameters<Target[K]>) => void
: void
};π Actual behavior
Parameters<Target[K]> has the error:
Type 'Target[K]' does not satisfy the constraint '(...args: any) => any'.
Type 'Target[keyof Target]' is not assignable to type '(...args: any) => any'.
Type 'Target[string] | Target[number] | Target[symbol]' is not assignable to type '(...args: any) => any'.
Type 'Target[string]' is not assignable to type '(...args: any) => any'
π Expected behavior
This code previously compiled without errors in the TS 4.3-beta
whzx5byb
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