Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

it doesn't. never prevents reading and readonly prevents (over)writing.

GP just focused on the never-part of your question.



never means nothing can be assigned to it, so in that sense it's already readonly


Correct, so the question should have been: is readonly necessary?

I wouldn’t call myself an expert in TypeScript’s type system (although I use it daily), so I’m not sure about that one.

I do know I would have omitted readonly if I did this myself, but perhaps by mistake.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: