@Andrew: Now not rather. TypeScript’s
readonly modifier does no longer have any runtime manifestation — it is utterly compiled away, so
ORIGIN may have two mutable homes
Object.freeze(), alternatively, freezes an object at runtime. When an object is frozen, it might probably now not be adjustments. Fro instance, belongings values cannot be modified, and homes cannot be got rid of, added, or reconfigured.
readonly offers you some coverage thru type-checking at compile-time, while
Object.freeze() in fact prevents changes at runtime.