You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This is OKtypeTuple=[string,number]constt : Tuple=['string',2]const[s,n]=t// This errors // [ts] Type 'Readonly<[string, number]>' is not an array type.// const rs: stringtypeReadonlyTuple=Readonly<[string,number]>constrt : ReadonlyTuple=['string',2]const[rs,rn]=rt
This is probably a limitation of the Readonly<> that causes it to lose the "array-ness" of the tuple type. You can work around it as follows:
typeReadonlyTuple=Readonly<[string,number]>&[string,number];constrt: ReadonlyTuple=['string',2]rt[0]='zero';// error as expected, still read-onlyconst[rs,rn]=rt// no error, accepts as array type
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Activity
jcalz commentedon Aug 2, 2017
This is probably a limitation of the
Readonly<>that causes it to lose the "array-ness" of the tuple type. You can work around it as follows:olegdunkan commentedon Aug 2, 2017
ReadonlyTupleis mapped type, destructing requires array like type in your casemhegazy commentedon Sep 7, 2017
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.