Microsoft/TypeScript

[Rename symbol command] Remove unnecessary named import

Open

#56,497 建立於 2023年11月21日

在 GitHub 查看
 (2 留言) (1 反應) (0 負責人)TypeScript (6,726 fork)batch import
Effort: CasualExperience EnhancementHelp WantedSuggestion

倉庫指標

Star
 (48,455 star)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 9 個 PR)

描述

  • VS Code Version: 1.84.2 (1a5daa3a0231a0fbba4f14db7ec463cf99d7768e)
  • OS Version: macOS Sonoma 14.1.1

Steps to Reproduce:

  1. Create 2 JS files:
// utils.js
export const foo = () => console.log('Hello world!');
// index.js
import { foo as bar } from "./utils.js";

bar();
  1. Put your cursor in the word "foo" in utils.js and use the "Rename Symbol" command (F2 by default) to rename the function to bar.
  2. Observe the import in index.js has changed to import { bar as bar } from "./utils.js". Since the names import is no longer necessary, the command should instead change the import to import { bar } from "./utils.js".

貢獻者指南