Microsoft/TypeScript

Comment like jsx text emitted twice when preserve enabled

Open

#61,860 创建于 2025年6月13日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)TypeScript (48,455 star) (6,726 fork)batch import
BugDomain: JSX/TSXHelp Wanted

描述

🔎 Search Terms

comment like jsx text, preserve jsx

🕗 Version & Regression Information

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

⏯ Playground Link

https://www.typescriptlang.org/play/?jsx=1#code/GYVwdgxgLglg9mABAQQA6oBQEpEG8C+AUMRAgM5SIBWZAHogLyIA8aqAfAPQBUiYcibp1w9EARkGdxAJgDMiUdMn5R-Sc05t2AbkJA

💻 Code

function App() {}
const jsx = <App>/* no */{/* 1 */ 123 /* 2 */}/* no */</App>;

🙁 Actual behavior

These duplicate sections will be rendered in the JSX text output:

"use strict";
function App() { }
const jsx = <App> /* no *//* no */{/* 1 */123 /* 2 */} /* no *//* no */</App>
//                ~~~~~~~                              ~~~~~~~

🙂 Expected behavior

"use strict";
function App() { }
- const jsx = <App> /* no *//* no */{/* 1 */123 /* 2 */} /* no *//* no */</App>
+ const jsx = <App> /* no */{/* 1 */123 /* 2 */} /* no */</App>

Additional information about the issue

No response

贡献者指南

Comment like jsx text emitted twice when preserve enabled · Microsoft/TypeScript#61860 | Good First Issue