Skip to content

Bug with default export class in namespace #16301

Description

@ajafff

TypeScript Version: 2.3.4 and current playground

Code

namespace ns {
    export default class Foo{ } // no error
}
ns.Foo; // error
ns.default; // no error

playground

Expected behavior:
Error at declaration that default exports are only allowed in ECMAScript modules.

Actual behavior:
No error at declaration.

Code completion shows ns.Foo but compiler prints warning.
Code completion does not show ns.default but tooltip reveals it is class ns.Foo. That's completely wrong because the emit does not contain any default export.

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
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions