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

auto import always choose the type declaration in the folder that not top level #24742

Closed
Kingwl opened this issue Jun 7, 2018 · 2 comments
Closed
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@Kingwl
Copy link
Contributor

Kingwl commented Jun 7, 2018

TypeScript Version: 3.0.0-dev.201xxxxx

Search Terms:

Code

// node_module/xxx/lib/index.d.ts
export declare a: number;

// src/a.ts
a/*here*/

Expected behavior:

insert the code: import { a } from 'xxx'

Actual behavior:

insert the code: import { a } from 'xxx/lib'

Playground Link:

Related Issues:

@Kingwl Kingwl changed the title auto import always choose the type declaration in the folder not top level auto import always choose the type declaration in the folder that not top level Jun 7, 2018
@mhegazy mhegazy added the Bug A bug in TypeScript label Jun 7, 2018
@mhegazy mhegazy assigned ghost Jun 7, 2018
@mhegazy mhegazy added this to the TypeScript 3.0 milestone Jun 7, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Jun 7, 2018

Following this repro, i am not even getting completions for a.

@ghost ghost added the Fixed A PR has been merged for this issue label Jun 7, 2018
@ghost
Copy link

ghost commented Jun 7, 2018

@Kingwl Assuming that the problem here was that there was a "main" field in the package.json referencing lib/index.js, but no typings field. If so, should be fixed by #24774.

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

2 participants