Skip to content

JSX: "extract to constant" generates invalid code when using fragment syntax #44249

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

Closed
OliverJAsh opened this issue May 25, 2021 · 0 comments Β· Fixed by #44252
Closed

JSX: "extract to constant" generates invalid code when using fragment syntax #44249

OliverJAsh opened this issue May 25, 2021 · 0 comments Β· Fixed by #44252
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol Fix Available A PR has been opened for this issue Good First Issue Well scoped, documented and has the green light Help Wanted You can do this

Comments

@OliverJAsh
Copy link
Contributor

Bug Report

πŸ”Ž Search Terms

Related: #29890

jsx extract constant refactoring quick fix

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about refactorings

⏯ Playground Link

N/A

πŸ’» Code

<>
    <span>Hello</span>
</>
  1. Highlight <span>Hello</span>
  2. Run refactoring "extract to constant"

πŸ™ Actual behavior

const newLocal = <span>Hello</span>;
<>
    newLocal
</>

πŸ™‚ Expected behavior

const newLocal = <span>Hello</span>;
<>
    {newLocal}
</>
OliverJAsh added a commit to OliverJAsh/TypeScript that referenced this issue May 25, 2021
@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol Good First Issue Well scoped, documented and has the green light Help Wanted You can do this labels May 25, 2021
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.4.0 milestone May 25, 2021
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label May 25, 2021
sandersn pushed a commit that referenced this issue May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol Fix Available A PR has been opened for this issue Good First Issue Well scoped, documented and has the green light Help Wanted You can do this
Projects
None yet
3 participants