You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swc.transform with experimental.emitIsolatedDts does not include comments in the output with preserveAllComments: true
Ideally, JSDoc comments could be preserved in the .d.ts output file
Input code
constresult=awaitswc.transform(fullTextFromFile,{filename: filePath,jsc: {parser: {syntax: "typescript",tsx: true,},preserveAllComments: true,// Does not include comments in the emitted fileexperimental: {emitIsolatedDts: true,},},});
Config
No response
Playground link (or link to the minimal reproduction)
Just to weigh in a little to help prioritize -- without comments, the emitIsolatedDts feature is not super useful in its current form. I think anyone building .d.ts files for consumption intends for them to be consumed by humans, like .d.ts files within node modules that power typechecking and autocomplete. Stripping all the nice documentation or explanation about these files makes those artifacts far far less useful for humans, and much different than the ones that the TypeScript compiler itself would produce.
I know this is probably a super annoying and invasive change to make to swc but as someone who adopted and then had to un-adopt the emitIsolatedDts experiment because of this missing piece, it'd be really great to get actual drop in compatibility with tsc! Also, I know it's marked experimental so no unfair expectations over here, just wanted to share.
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Describe the bug
swc.transform
withexperimental.emitIsolatedDts
does not include comments in the output withpreserveAllComments: true
Ideally, JSDoc comments could be preserved in the
.d.ts
output fileInput code
Config
No response
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.7.25&code=H4sIAAAAAAAAA02OMQ7CMAxF95zij1AB3cvCgJBg7QmckNIg4lSJow5V704oHTr6P%2Ft911WlUKElP3wsHu01GEhPgjtGl3qMlOC4RBZpNCeJxKkL0SNkGbL8bi8DRfIgHJEkOn5hCTZIF8TZaxs3KFrJkVNBQb%2BtkdInfbEQP6HLRq26zEZcYKTlu1sZd9SsJQfoZpXuMSng78MEKgjzWc3qC9n9%2B5rdAAAA&config=H4sIAAAAAAAAA1WPSw7DIAwF9zkF8rrbdtE79BCIOhERP9mOVBTl7oUE0maH3xszsA5KwcwGnmotxzIkTYx0ziXhHER%2FSgKSE7IhmwRuvRWu1agd4x5tRwOiaUKpW8j3hoOLkbHjLfM22DH%2FC030iZD5ClZUh8nhVTc0Jfj4XvayfaQ%2B9tA%2F4Ad12XkxWH71TaEFh%2B0LYuVI0xQBAAA%3D
SWC Info output
No response
Expected behavior
The comments from the source file text to be included in the output
Actual behavior
No response
Version
"1.7.23"
Additional context
No response
The text was updated successfully, but these errors were encountered: