Skip to content

Inferring return types with import attributes causes debug assertion. #56394

@dragomirtitian

Description

@dragomirtitian

🔎 Search Terms

infer return type import attributes

🕗 Version & Regression Information

  • This is a crash

⏯ Playground Link

Playground Link

💻 Code

// @module: NodeNext

// @filename: node_modules/inner/index.d.mts
export const esm = true;

// @filename: node_modules/inner/package.json
{ "name": "inner", "exports": { "./mjs": "./index.mjs" } }

// @filename: foo.ts
export /*a*/function/*b*/ fn() {
    return import("inner/mjs")
}

🙁 Actual behavior

Using infer return type on fn will cause a debug assertion.

🙂 Expected behavior

Should infer the return type.

Additional information about the issue

Found while working on isolated declaration.

It's caused by ImportAttributes not going through the full emit pipeline and thus not having their position assigned if they are part of an import type node.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions