Skip to content

"Remove 'type' from import" produces invalid syntax #55363

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
lgarron opened this issue Aug 14, 2023 · 1 comment · Fixed by #55365
Closed

"Remove 'type' from import" produces invalid syntax #55363

lgarron opened this issue Aug 14, 2023 · 1 comment · Fixed by #55365
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@lgarron
Copy link

lgarron commented Aug 14, 2023

🔎 Search Terms

"Remove 'type' from import", IntelliSense, autocomplete, suggestion

🕗 Version & Regression Information

I'm seeing this in VSCode, with all extensions disabled:

Bundled TypeScript version: v5.1.0

Version: 1.81.0
Commit: 6445d93c81ebe42c4cbd7a60712e0b17d9463e97
Date: 2023-08-02T12:38:28.722Z (1 wk ago)
Electron: 22.3.18
ElectronBuildId: 22689846
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin arm64 22.6.0

⏯ Playground Link

N/A

💻 Code

Use the following files:

// main.ts
import { TwistyAlgEditor, type TwistyPlayer } from "./other-file";

new TwistyPlayer();

// other-file.ts
export class TwistyAlgEditor {}
export class TwistyPlayer {}

Then attempt to select the Remove 'type' from import of 'TwistyPlaver' from "cubing/twisty" suggestion for new TwistyPlayer:

Screenshot 2023-08-14 at 19 26 33

🙁 Actual behavior

The code is rewritten to:

import { TwistyAlgEditorTwistyPlayer,  } from "./other-file";

new TwistyPlayer();

🙂 Expected behavior

The code is rewritten to:

import { TwistyAlgEditor, TwistyPlayer } from "./other-file";

new TwistyPlayer();
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Aug 14, 2023
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 5.3.0 milestone Aug 14, 2023
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Aug 16, 2023
@lgarron
Copy link
Author

lgarron commented Sep 21, 2023

Thanks for the fix! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants