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
In general, readonly tuples appear to not have a readonly length property.
typeTest=Pick<[number],'length'>;// ^?// type Test = { length: 1; }// no readonly modifierdeclareconstx: readonly[number?];x.length=0;// no errordeclareconsty: readonly[number, ...number[]];y.length=0;// no errordeclareconstz: readonlynumber[];z.length=0;// error, as expected
🔎 Search Terms
readonly tuple length property
🕗 Version & Regression Information
This is the behavior in every version I tried, and I reviewed the FAQ for entries about common "Bugs" that aren't bugs
Bug Report
In general,
readonly
tuples appear to not have areadonly length
property.🔎 Search Terms
readonly tuple length property
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
🙁 Actual behavior
A
readonly
tuple'slength
property is notreadonly
, and can as such we overwritten.🙂 Expected behavior
A
readonly
tuple'slength
property should bereadonly
, similar to arrays, and disallow writes.The text was updated successfully, but these errors were encountered: