[Suggestion]: Add --strictReadonlyChecks option to catch runtime errors modifying frozen objects at compile time #11481
Labels
Revisit
An issue worth coming back to
Suggestion
An idea for TypeScript
Too Complex
An issue which adding support for may be too complex for the value it adds
The Problem
It is currently not possible to consistently catch modifications of frozen objects, which lead to runtime errors in strict mode. See #11180 and #11480 for examples.
Proposed Solution
Add a
strictReadonlyChecks
compiler option, which does not allow to assignreadonly
fields to non-readonly (regular) fields. Also do not allow deleting items from readonly dictionaries (#11480), unless this can already be solved by regular compiler behavior.The text was updated successfully, but these errors were encountered: