-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Syntactically important comments removed from emitted code (@deprecated
and others)
#51177
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
Comments
Maintainer snipes are not constructive or helpful, whether here or in the other thread. Please stop. What's the difference between this issue and #14619? It sounds like you're asking for an in-between option between "no comments" and "all comments" that is "(Some? All?) JS doc comments" ? |
Implied feature request seems to be “preserve JSDoc in generated |
@RyanCavanaugh as mentioned, when specifying A function/method/prop/etc with one of these tags often means something entirely different to the same object without the tag. Given that the docs for I don't think anyone would add a Given the above 3 statements, I think it's incorrect behavior for TS to strip these syntactically important tags from the emitted As @fatcerberus said, the effect that I believe should happen is The difference is I am not requesting the feature (nor am I proposing the same solution), I'm reporting a bug where TypeScript is behaving incorrectly with regards to both the docs and fair assumption. At least in part, TypeScript is aware of JSDoc tags and their meaning, this could be built upon to include the syntaxes TypeScript doesn't have, and to always exclude them from the effects of Apologies for my behavior, I'll refrain from writing issues when I'm in a bad mood. |
Understood. People who have the same concerns about .d.ts size as you have about .js size, or even have concerns about the contents of their .d.ts files, would have equal footing to complain if we changed The worst case scenario would be something like someone having an API key or trade secret in a comment in their private source code, we change
If you care about the size of your JS output, but aren't running a proper minifier, then I'd argue you really don't care about the size of your JS output. More on this later. So all-up I don't think we'd be willing to unilaterally change the behavior of .d.ts emit. The stalled nature of #14619, which I think this boils down to in the absence of a unilateral change, comes down to whether TS having yet another commandline flag is really worth it, given that Really I'd argue that |
This issue has been marked as "Out of Scope" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Bug Report
🔎 Search Terms
remove comments, declaration, syntax, deprecated, jsdoc
🕗 Version & Regression Information
⏯ Playground Link
Playground link (Observe d.ts output)
💻 Code
🙁 Actual behavior
The JSDoc comment is removed from the
d.ts
file🙂 Expected behavior
The JSDoc comment contains syntax which is recognised by most editors and developers to have significant meaning regarding the associated object. It is part of the language and should not be removed from declaration files.
removeComments
is documented here with the following text;Additional Info
I would like to emphasise; "when converting into JavaScript"
I would also like to point out;
d.ts
files are NOT JavaScript.The documentation does not state anywhere that JSDoc will be removed from declaration files.
You're probably thinking...
"turn off removeComments"
I shouldn't have to effect the size of my JS output for my dts output to be syntactically correct.
"use a 3rd party minifier"
I shouldn't have to use 3rd party tools for TypeScript to have syntactically correct output.
"this is related the remove comments issues"
Yeah, there are a few of those.
(#14619) (#45187) (#26987) (#30307) (#20441)
What they fail to identify is that TypeScript fails to output syntactically correct dts when compiling with
removeComments
.and
have completely different meanings. The former being used in place of the latter is as bad as
object
in place ofMyInterface
; significant information is destroyed by the compiler.This is a bug which leaves every user to choose between;
a) broken dist dts
b) over-sized dist js
c) use a 3rd party library / hacky build process to fix the bug
The text was updated successfully, but these errors were encountered: