A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-2.ts
1constt:readonly[number,number,number]=[1,2,3];
2constc=[...t];
3c[0]=99;
4console.log(t[0],c[0]);
Modern
Answer & explanation
Console output
1 99
Why
Unlike a plain cast, the spread operator copies elements into a new array, breaking aliasing. Mutating the copy c does not affect the readonly tuple t. So t[0] remains 1 and c[0] is 99. That is the safe way to mutate readonly data.