DEV Community

Jaga santagostino
Jaga santagostino

Posted on • Originally published at jagascript.com on

Disable VScode TypeScript alias in rename refactoring

Since TypeScript 3.4 a setting has been implemented into tsserver that makes refactoring > rename create an alias in the local scope insted of change the original name

rename

this abomination was enabled by default on VScode and after months of pain I found a way to disable it.

πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰

The configuration is called typescript.preferences.renameShorthandProperties

rename-alias-ts-vscode-setting.png

Top comments (10)

Collapse
 
gaspard profile image
Gaspard Bucher

Please note that you should turn both JS and TS options to false in case you edit JS code and do not want the weird thing to happen again.

"javascript.preferences.renameShorthandProperties": false,
"typescript.preferences.renameShorthandProperties": false
Collapse
 
guyost profile image
GuyoST

Hello,

I didn't know that and I renamed a class and VScode created an alias, but I don't know how I can remove this alias manually now. Can someone knows how to do that ? where is this alias defined ?

Collapse
 
incleaf profile image
Hyeonsu Lee

Dang, I've always been so annoyed since this feature was added! This option should be false as default. Thank you so much man πŸ‘

Collapse
 
avilde profile image
Andris Vilde

Thank you very much! Was looking for this - didn't know there was such a setting.

Collapse
 
hsrobbv profile image
hsrobbv

THANK YOU ugh

Collapse
 
doubledherin profile image
Wendy Dherin

Heads up that renameShorthandProperties has been deprecated; it's now useAliasesForRenames.

Collapse
 
voiedev profile image
Charles Allen

Thanks!

Collapse
 
t7yang profile image
t7yang

Thank a lot, this is really annoying.

Collapse
 
jonaskello profile image
Jonas Kello

Thanks! Have been looking for this since it was changed.

Collapse
 
lucax88x profile image
Luca Trazzi

Thanks you man.