Skip to content

Allows to mutate const with non-null assertion #21848

@ghost

Description

TypeScript Version: 2.8.0-dev.20180209

Code

declare const x: number | undefined;
x!++;

Expected behavior:

src/a.ts(2,2): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.

Actual behavior:

No error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issueHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions