News for hackers. Stuff that matters.
Re:TypeScript: Branded Types by nsonha on Wednesday April 24, 2024 @09:31PM (#40152249)
how would readonly fixes consumers reading the property?
Re:TypeScript: Branded Types by whilenot-dev on Thursday April 25, 2024 @01:47AM (#40153888)
it doesn't. never prevents reading and readonly prevents (over)writing.

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

Re:TypeScript: Branded Types by nsonha on Thursday April 25, 2024 @07:11PM (#40164202)
never means nothing can be assigned to it, so in that sense it's already readonly
Re:TypeScript: Branded Types by samtheprogram on Saturday April 27, 2024 @02:31AM (#40177776)
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.