Microsoft/TypeScript
View on GitHub[Rename symbol command] Remove unnecessary named import
Open
#56,497 opened on Nov 21, 2023
Effort: CasualExperience EnhancementHelp WantedSuggestion
Repository metrics
- Stars
- (48,455 stars)
- PR merge metrics
- (Avg merge 6d 17h) (9 merged PRs in 30d)
Description
- 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".