Skip to content

Simultaneous use of export equals and export default in a module #10854

Closed
@tinganho

Description

@tinganho

I have some NPM modules written that uses the old default export syntax:

declare module 'my-module' {
    function test(): string;
    export = test;
}

To promote ES import syntax but still keep the old one, I wanted to add both the new and old default export syntax:

declare module 'my-module' {
    function test(): string;
    export default test;
    export = test; // An export assignment cannot be used in a module with other exported element
}

Though it complains that it cannot use an export assignment with other export statements.

I think it is reasonable to support both syntax simultaneously in a module. Because choosing between both syntax. I would choose export = before export default, simply because of no API breakage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions