-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Organize Imports removes aliased imports that are in use. #22743
Comments
@andy-ms Thank you for the quick turn around. Can we please get this in TypeScript 2.8.2 as well since the bug potentially breaks code? |
Hi, I'm seeing this issue still in VSCode 1.23.1 and I'm not using either Typescript or aliases. For example in simple code like:
I can confirm that this has nothing to do with ESLint or Prettier and the only remedy is to set
However I want organizeImports on in general - this is the only file that it's screwing up. Any way to turn it off for just this file? Is there an ETA on a fix? Thanks! |
@iosdev-republicofapps I was just coming to look if this issue had already been opened, and I'm having the same problem. If you write it as: const allReducers = combineReducers({
reducer: reducer,
}); it will be fine. My guess is because it is not assigned to any variable, it's detecting the import as being unused. I'm wondering if, since this issue is dead, and it seems to be a little different, should this be opened as a unique issue instead? Or better yet, should this be opened in the vscode repo instead, since as you noted, it has nothing to do with TS. |
☝️ never mind, just saw your issue on that repo as well |
@iosdev-republicofapps That seems to work with |
TypeScript Version: 2.8.0-rc, 2.8.0-insiders.20180320
VS Code Version:
Search Terms: organize import imports remove alias
Code
Expected behavior:
Running "TypeScript: Organize Imports" in VS Code makes no change to the import statements.
Actual behavior:
The import statement is removed.
Work around:
Remove
as <ident>
from the import statement and the import statement is left untouched by the "Organize Imports" command.The text was updated successfully, but these errors were encountered: