Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dragomirtitian opened this issue Nov 14, 2023 · 2 comments Β· Fixed by #56395
Closed

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

dragomirtitian opened this issue Nov 14, 2023 · 2 comments Β· Fixed by #56395
Labels
Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@dragomirtitian
Copy link
Contributor

dragomirtitian commented Nov 14, 2023

πŸ”Ž 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.

@SarthakNikhal
Copy link

Hey! Can I work on this issue?

@jakebailey
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
4 participants