A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-159.ts
1classC{
2privatesecret=42
3reveal(){returnthis.secret}
4}
5console.log((newC()asany).secret)
Type Erasure
Answer & explanation
Console output
42
Why
TypeScript's `private` is enforced only by the compiler; the field is emitted as an ordinary public property (unlike a real `#private` field). Casting the instance to `any` removes the access check, and reading `.secret` returns 42. Soft privacy is erased at runtime.