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

TypeScript Organize Imports removes aliased imported types that are in use #47706

Closed
AustonZ opened this issue Apr 12, 2018 · 2 comments
Closed
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@AustonZ
Copy link

AustonZ commented Apr 12, 2018

Issue Type: Bug

  1. Create a new TS project that uses an NPM package, such as "typescript"
  2. Create a TS file that imports a type from that package, aliasing it to a different name. Use that aliased type in the code. E.g.:
import { BaseType as Foo } from "typescript";
const x: Foo = null;
  1. SHIFT+ALT+O (or CTRL+SHIFT+P, TypeScript: Organize Imports)

Expect:
No changes

Actual:
The import line is removed, and the code no longer compiles.

VS Code version: Code 1.22.1 (950b8b0, 2018-04-06T02:26:57.615Z)
OS version: Windows_NT x64 10.0.14393

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz (4 x 2904)
Memory (System) 15.84GB (8.69GB free)
Process Argv C:\Program Files\Microsoft VS Code\Code.exe
Screen Reader no
VM 0%
Extensions: none
@vscodebot
Copy link

vscodebot bot commented Apr 12, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@vscodebot vscodebot bot added the typescript Typescript support issues label Apr 12, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 12, 2018

Duplicate of microsoft/TypeScript#22743

Should already be fixed in vscode insiders

@mjbvz mjbvz closed this as completed Apr 12, 2018
@mjbvz mjbvz added upstream Issue identified as 'upstream' component related (exists outside of VS Code) *duplicate Issue identified as a duplicate of another issue(s) labels Apr 12, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators May 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

2 participants