Skip to content

Inconsistent behavior a class not being readonly if it is inside a module #16579

Closed
@webbiesdk

Description

@webbiesdk

TypeScript Version: 2.3.4

Code

module Bar {
    export class Foo {
        bla = 123;
    }
}

class Foo {
    bla = 123;
}

Bar.Foo = Foo; // no error
Foo = Bar.Foo; // error: "Cannot assign to 'Foo' because it is not a variable.

Expected behavior:
Either both of the last two lines to report an error, or none of them.

Actual behavior:
It is only an error to replace a class, if it is not inside a module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Won't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix it

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions