Skip to content

auto-import prefers package import over relative path #26044

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

Closed
ajafff opened this issue Jul 28, 2018 · 2 comments
Closed

auto-import prefers package import over relative path #26044

ajafff opened this issue Jul 28, 2018 · 2 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@ajafff
Copy link
Contributor

ajafff commented Jul 28, 2018

This is a follow-up on #25279, because one of the cases was not fixed (or regressed since then?)

TypeScript Version: 3.1.0-dev.20180728

Search Terms:

Code

  • clone https://github.com/fimbullinter/wotan
  • yarn
    • creates a symlink node_modules/@fimbul/<name> for each packages/<name>
  • create a new file packages/mimir/src/test.ts
  • type isAsyncFunction and use auto-import from the completion list or quickfix

Expected behavior:

import { isAsyncFunction } from "./utils";

isAsyncFunction

Actual behavior:

import { isAsyncFunction } from "@fimbul/mimir/src/utils";

isAsyncFunction

Related Issues:
#25279

@netanelgilad
Copy link

Experiencing this as well. My specific scenario is described on #26047

@mhegazy mhegazy added the Bug A bug in TypeScript label Jul 30, 2018
@mhegazy mhegazy assigned ghost Jul 30, 2018
@mhegazy mhegazy added this to the TypeScript 3.1 milestone Jul 30, 2018
ghost pushed a commit that referenced this issue Jul 30, 2018
ghost pushed a commit that referenced this issue Jul 30, 2018
ghost pushed a commit that referenced this issue Jul 30, 2018
ghost pushed a commit that referenced this issue Aug 1, 2018
…obal import specifiers (#25834)

* importFixes: When one file redirects to another, consider both for global import specifiers

* Add test for #26044

* Avoid a symlinked package globally importing itself (fixes another case of #26044)

* Compare to node_modules with getCanonicalFileName
@ghost
Copy link

ghost commented Aug 6, 2018

Seems to be fixed by #25834.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants