-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
renameShorthandProperties
has confusing name
#93589
Comments
Yes the general idea of what this setting does is captured in the description:
PRs welcome if you have a suggestion for a different name |
I don't think we need to rename the setting, but rather I think the boolean should be flipped, so that the name matches the behaviour.
|
We can't flip the value of an existing setting because that will flip the behavior for everyone who has changed the setting, but we can flip (or modify) the setting name name if you have thoughts on that |
What is currently
|
…'useAliasesForRenames'
Renamed to For verification:
|
Steps to Reproduce:
renameShorthandProperties
settingI have been trying to get my head around the
renameShorthandProperties
setting. After reading through microsoft/TypeScript#29238 and running some tests, it seems that this setting may have been named or configured incorrectly. For this reason, I am suggesting some changes.As far as I can tell, the setting name represents what the setting will do when disabled—not what it will do when it's enabled (the default).
Example from microsoft/TypeScript#29238 (comment):
What happens if I rename at use (with the default setting)?
The setting name ("rename shorthand properties") and its default value of
true
would seem to suggest that an alias should not be introduced, and the destructured property (aka "shorthand property") should also be renamed:However, the opposite will happen: the destructured property will be aliased, not renamed:
Am I right in thinking this is potentially confusing, or do I misunderstand something?
If my thinking is correct, I believe the setting should be renamed (to avoid confusion), or the current name can stay but the default should be flipped from
true
tofalse
, to reflect what the setting is actually doing. Note however that this would be a breaking change.Does this issue occur when all extensions are disabled?: Yes
Related:
The text was updated successfully, but these errors were encountered: