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

No auto-import from aliased symbol from ts files in js files #57740

Closed
jasonlyu123 opened this issue Mar 12, 2024 · 2 comments Β· Fixed by #57778
Closed

No auto-import from aliased symbol from ts files in js files #57740

jasonlyu123 opened this issue Mar 12, 2024 · 2 comments Β· Fixed by #57778
Labels
Bug A bug in TypeScript Domain: Auto-import Help Wanted You can do this

Comments

@jasonlyu123
Copy link
Contributor

jasonlyu123 commented Mar 12, 2024

πŸ”Ž Search Terms

default export
auto-import
barrel export

πŸ•— Version & Regression Information

  • This changed between versions 5.3 and 5.4

⏯ Playground Link

Reproduction repository instead of playground because it needs at least 2 files. One in ts and one in js.
https://github.com/jasonlyu123/auto-import-aliased

πŸ’» Code

// foo.ts

export default function foo() {}

function foo2() {}
export { foo2 }
// index.js
foo
// ^trigger completion here

πŸ™ Actual behavior

No auto-import to import the function foo and foo2

πŸ™‚ Expected behavior

Has auto-import like in 5.3.

Additional information about the issue

This only happens in js files when trying to auto-import values from a ts file and the symbol has some alias or is a default export. This seems to have to do with #53619. In another check for type-only-location, the symbol flags are combined with flags from the aliased symbol and the symbol has flags like class and function.

@RyanCavanaugh
Copy link
Member

foo not being offered is correct; this is not an externally-visible name. foo2 should be offered, though

@dummdidumm
Copy link

Why is foo not externally visible? If I type foo inside a .ts file, I get offered the default import as autocompletion. I would expect the same to be true in a .js file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Auto-import Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants