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 Anna โ€ข

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
ย 
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
ย 
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
ย 
hsrobbv profile image
hsrobbv โ€ข

THANK YOU ugh

Collapse
ย 
avilde profile image
Andris Vilde โ€ข

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

Collapse
ย 
jonaskello profile image
Jonas Kello โ€ข

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

Collapse
ย 
t7yang profile image
t7yang โ€ข

Thank a lot, this is really annoying.

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
ย 
lucax88x profile image
Luca Trazzi โ€ข

Thanks you man.