Skip to content

Bad error message for import *-ing an export= #24542

@DanielRosenwasser

Description

@DanielRosenwasser
// ./b.ts
function foo() {
}
export = foo;
// ./a.ts
import * as b from "./b";
b;
// tsconfig.json
{
    "compilerOptions": {
        "moduleResolution": "node",
        "outDir": "lib"
    },
    "include": [
        "./a.ts"
    ]
}

Expected:

ECMAScript imports can only reference an 'export =' declaration with the 'esModuleInterop' flag enabled and by using default imports.

Actual:

Module '"./b"' resolves to a non-module entity and cannot be imported using this construct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: ES ModulesThe issue relates to import/export style module behaviorDomain: Error MessagesThe issue relates to error messagingFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions