-
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 TypeScriptRevisitAn issue worth coming back toAn issue worth coming back to
Milestone
Description
Let's say i define a tuple type like this :
type MyTuple = [number, number]
Now when i do this:
let a: MyTuple = [1, 2]
let b: MyTuple = a.slice();
The compiler complains that TS2322: Type 'number[]' is not assignable to type '[number, number]'. Property '0' is missing in type 'number[]'.
I think it should work, slice without argument (or slice(0) or even slice(0,2)) should allow to clone a tuple.
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 TypeScriptRevisitAn issue worth coming back toAn issue worth coming back to