Microsoft/TypeScript
Auf GitHub ansehen[Rename symbol command] Remove unnecessary named import
Open
#56.497 geöffnet am 21. Nov. 2023
Effort: CasualExperience EnhancementHelp WantedSuggestion
Repository-Metriken
- Stars
- (48.455 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)
Beschreibung
- VS Code Version: 1.84.2 (1a5daa3a0231a0fbba4f14db7ec463cf99d7768e)
- OS Version: macOS Sonoma 14.1.1
Steps to Reproduce:
- Create 2 JS files:
// utils.js export const foo = () => console.log('Hello world!');// index.js import { foo as bar } from "./utils.js"; bar();
- Put your cursor in the word "foo" in utils.js and use the "Rename Symbol" command (
F2by default) to rename the function tobar. - 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 toimport { bar } from "./utils.js".