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

TS AutoImport deep vs shallow imports #20160

Closed
mjbvz opened this issue Nov 20, 2017 · 2 comments
Closed

TS AutoImport deep vs shallow imports #20160

mjbvz opened this issue Nov 20, 2017 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Nov 20, 2017

From @bradzacher on November 20, 2017 4:12

I noticed that when doing an autoimport in TS, code seems to prefer deep imports over shallow ones.

I.e. when working with graphql, if you try and import GraphQLString, code places this import import { GraphQLString } from 'graphql/type/scalars'; instead of using the import on the base package import { GraphQLString } from 'graphql';.

It would be good if code could detect this and prefer shallow imports where possible.
Esp with node module imports, because doing a deep import can technically be fragile (i.e. a module author may not intend you to import from one of the modules' internal folders).

Copied from original issue: microsoft/vscode#38744

@mjbvz
Copy link
Contributor Author

mjbvz commented Nov 20, 2017

Possible duplicate of #19694

@mhegazy
Copy link
Contributor

mhegazy commented Nov 20, 2017

Should be working correctly in latest drop of TypeSript (typescript@next). VSCode ships with an older version of TypeScript. Please see Using Newer TypeScript Versions documentation for more details on updating your VSCode to use a different version of TypeScript.

@mhegazy mhegazy closed this as completed Nov 20, 2017
@mhegazy mhegazy added the Duplicate An existing issue was already created label Nov 20, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants