Skip to content
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

Allow Extract Constant in expression-bodied arrow functions #18924

Open
amcasey opened this issue Oct 3, 2017 · 0 comments · May be fixed by #55349
Open

Allow Extract Constant in expression-bodied arrow functions #18924

amcasey opened this issue Oct 3, 2017 · 0 comments · May be fixed by #55349
Labels
Domain: Refactorings e.g. extract to constant or function, rename symbol Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Milestone

Comments

@amcasey
Copy link
Member

amcasey commented Oct 3, 2017

const f = () => 1 + [#|(2 + 3)|] + 4;

Expected:

const f = () => {
    const newLocal = (2 + 3);
    return 1 + newLocal + 4;
};

We can detect this scenario, but ChangeTracker doesn't support overlapping transformations (i.e. substituting newLocal into the expression and then putting the result into a return statement).

@amcasey amcasey self-assigned this Oct 3, 2017
@amcasey amcasey added Domain: Refactorings e.g. extract to constant or function, rename symbol Suggestion An idea for TypeScript labels Oct 3, 2017
amcasey added a commit to amcasey/TypeScript that referenced this issue Oct 3, 2017
@amcasey amcasey added this to the TypeScript 2.6 milestone Oct 3, 2017
@mhegazy mhegazy modified the milestones: TypeScript 2.6, TypeScript 2.7 Oct 9, 2017
@mhegazy mhegazy modified the milestones: TypeScript 2.7, TypeScript 2.8, Future Jan 9, 2018
@weswigham weswigham added the In Discussion Not yet reached consensus label Nov 6, 2018
@RyanCavanaugh RyanCavanaugh added Experience Enhancement Noncontroversial enhancements and removed In Discussion Not yet reached consensus labels Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Refactorings e.g. extract to constant or function, rename symbol Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants