When developing in JavaScript/TypeScript, if you import an object and later remove all related code, itโs best to remove the import statement as well. Instead of manually searching for and deleting unused imports, you can use a VSCode shortcut to do it automatically.
In the example below, HostListener
is no longer referenced:
VSCode Default Shortcut (Windows)
Alt + Shift + O
Pressing this shortcut will make VSCode automatically remove the unused import.
ยฉ 2025 juniyunapapa@gmail.com.