microsoft / microsoft/TypeScript
Comment like jsx text emitted twice when preserve enabled
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- PR merge metrics
- PR metrics pending
Description
### 🔎 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
```tsx
function App() {}
const jsx = /* no */{/* 1 */ 123 /* 2 */}/* no */;
```
### 🙁 Actual behavior
These duplicate sections will be rendered in the JSX text output:
```jsx
"use strict";
function App() { }
const jsx = /* no *//* no */{/* 1 */123 /* 2 */} /* no *//* no */
// ~~~~~~~ ~~~~~~~
```
### 🙂 Expected behavior
```diff
"use strict";
function App() { }
- const jsx = /* no *//* no */{/* 1 */123 /* 2 */} /* no *//* no */
+ const jsx = /* no */{/* 1 */123 /* 2 */} /* no */
```
### Additional information about the issue
_No response_
Contributor guide
Research direction
Start with the linked TypeScript Playground and the TSX reproducer using preserve JSX handling. Compare the emitted JSX text with the expected output: each /* no */ comment should appear once rather than being duplicated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100