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

tsc looses trailing comments in the produced js files #60811

Open
OrKoN opened this issue Dec 18, 2024 · 1 comment
Open

tsc looses trailing comments in the produced js files #60811

OrKoN opened this issue Dec 18, 2024 · 1 comment

Comments

@OrKoN
Copy link

OrKoN commented Dec 18, 2024

πŸ”Ž Search Terms

"missing comments", "missing comments in .js output", "trailing comments"

πŸ•— Version & Regression Information

Happens in every version available in the playground (3.3.3 to v5.8.0-dev.20241218)

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.7.2#code/MYGwhgzhAECC0G8CwAoa7oHpPQNYFN8AHAWggHsAnAF3wBNoJqwbUNoBbfagC3LtgAKAJSI27DMHIA7CiHwA6EOQDmggEQUa9dcIDc49AF9DWHAWJkqtBvml1URoA

πŸ’» Code

class A {
    // keep-sorted start
    methodA() {
        console.log("sorted");
    }
    // keep-sorted end
}

πŸ™ Actual behavior

// keep-sorted end is missing in the .js output.

πŸ™‚ Expected behavior

// keep-sorted end is retained in the .js output.

Additional information about the issue

No response

@MartinJohns
Copy link
Contributor

Related: #56055 (comment)

FYI 100% comment preservation is not a goal of TS's emitter and you should try not to put yourself in a position where you need all comments in arbitrary positions to be maintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants