-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Closed
Copy link
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
π Search Terms
toString mapped type
π Version & Regression Information
- This changed between versions 4.6 and 4.7
β― Playground Link
π» Code
type Mappy<T extends unknown[]> = { [K in keyof T as K]: T[K] };
type NotArray = Mappy<number[]>;
declare function doArrayStuff(x: unknown[]): void;
declare const x: NotArray;
doArrayStuff(x); // Error
π Actual behavior
Error on doArrayStuff(x)
:
Argument of type 'Mappy<number[]>' is not assignable to parameter of type 'unknown[]'.
Types of property 'toString' are incompatible.
Type 'number' is not assignable to type '() => string'
π Expected behavior
No error, type of x
's toString
is () => string
.
Additional information about the issue
No response
DanielRosenwasserjcalz
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