Skip to content

Error message at a constant or a read-only property could be more specific #28297

@ghost

Description

TypeScript Version: 3.2.0-dev.20181101

Code

const isMutable = false;
isMutable = true;

Expected behavior:

Cannot assign to 'isMutable' because it is a constant.

Actual behavior:

Cannot assign to 'isMutable' because it is a constant or a read-only property. It's obviously not a property, and the compiler should be able to tell this. Note this is more tricky with namespace N { export const x = 0; }, which is also a property, but I think calling it just "a constant" in that case is fine.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions