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
{{ message }}
Repository navigation
Readonly open-ended tuples have writable length property #47260
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
Activity
jcalz commentedon Dec 31, 2021
(Linking to https://stackoverflow.com/questions/70501410/why-is-a-readonly-tuples-length-writable where this presumably came from)