-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 3.4.0-dev.20190202
Search Terms:
Readonly tuple, map, as const, const context
Code
const pairs = [['1', 1], ['2', 2]] as const
new Map(pairs);
Expected behavior:
No error
Actual behavior:
TS2345: Argument of type 'readonly [readonly ["1", 1], readonly ["2", 2]]' is not assignable to parameter of type 'readonly [{}, {}][]'.
Type 'readonly ["1", 1] | readonly ["2", 2]' is not assignable to type '[{}, {}]'.
Type 'readonly ["1", 1]' is missing the following properties from type '[{}, {}]': pop, push, reverse, shift, and 6 more.
Playground Link:
Related Issues:
The same issue applies to some libraries on DefinitelyTyped. Maybe readonly tuples should be added to Common mistakes, like arrays?
fazouane-marouane and dragomirtitian
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueFixedA PR has been merged for this issueA PR has been merged for this issue