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
C# has a nice quickfix called "inline temporary variable":
I propose adding an equivalent quickfix to TypeScript.
π Motivating Example
Developers frequently define variables and then only use them in one place. Inlining such variables can make the code more succinct and readable. As with all quickfixes, this quickfix would simply be a convenient shortcut for what you can already do by hand.
For example, the quickfix would transform this code:
constmessage='Failed to activate foobars.'thrownewError(message)
into
thrownewError('Failed to activate foobars.')
π» Use Cases
Automate the process of inlining temporary variables that are only used once (in both JavaScript and TypeScript code)
(???) Automate the process of inlining temporary variables that are used more than once. The C# quickfix does support this but I'm not sure if it's a useful feature, since inlining a variable that is used multiple times results in duplication.
We would need to define exactly which variable declarations are eligible for this quickfix. I'm not sure since I'm not a compiler person.
The text was updated successfully, but these errors were encountered:
Suggestion
π Search Terms
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
C# has a nice quickfix called "inline temporary variable":
I propose adding an equivalent quickfix to TypeScript.
π Motivating Example
Developers frequently define variables and then only use them in one place. Inlining such variables can make the code more succinct and readable. As with all quickfixes, this quickfix would simply be a convenient shortcut for what you can already do by hand.
For example, the quickfix would transform this code:
into
π» Use Cases
We would need to define exactly which variable declarations are eligible for this quickfix. I'm not sure since I'm not a compiler person.
The text was updated successfully, but these errors were encountered: