You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When autofix renaming a type property it should consider shorthands and fix appropriately so that it can avoid introducing type errors due to incorrect naming.
It might also seem counter-intuitive that renaming a local identifier should cause a runtime behavior change. But both can't be true (or false) at once.
I'm not quite sure I understand - how is this a runtime behaviour change?
return {
- prop,+ prop: prop2,
};
The shorthand assignment is syntactic sugar isn't it? So this change has no observable runtime side-effect.
I understand that renaming the prop does have runtime side-effects - which is the intent behind the refactor. But renaming a variable and using the long-hand property assignment to maintain the existing property name doesn't, right?
π Search Terms
rename autofix object shorthand property
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?#code/FA4MwVwOwYwFwJYHsoAIxKQCgJQC5UBvVABwCckSBTMuATwIGc4yEoBzVAXyOFX9QwUzUhWq06qALyoARLIDcfAWSpwIZNIWUCB5SjXoAaHdyVdgQA
π» Code
π Actual behavior
Screen.Recording.2023-08-14.at.13.16.38.mov
π Expected behavior
When autofix renaming a type property it should consider shorthands and fix appropriately so that it can avoid introducing type errors due to incorrect naming.
Optionally, it could be extended to be (hugely more complex) for some cases:
The text was updated successfully, but these errors were encountered: