Skip to content

[Suggestion]: Add --strictReadonlyChecks option to catch runtime errors modifying frozen objects at compile time #11481

Closed
@paulkoerbitz

Description

@paulkoerbitz

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 assign readonly 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RevisitAn issue worth coming back toSuggestionAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it adds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions