What is the Typescript syntax (if it exists) to include comments or text into the rendered js file?
Currently you can include all comments or no comments, but nothing in between.
//this doesn't work
/*this doesn't work either*/
I'm trying to:
This is how to include or exclude ALL comments in the rendered js files. I want to do this with syntax selectively throughout my typescript code though, not globally on or off
Tools > Options > WebEssestials > Typescript > Keep comments: true | false
My current guess is that it cannot be done but maybe this post will help others come to the same conclusion more quickly, or when/if it is possible, get the answer.
I'm trying whatever I find at the typescript playground
Thanks.
There is indeed only "on" or "off" for comment preservation. Adding some sort of metalanguage to let you decide which comments to keep and which to omit isn't a feature we're likely to add (because library developers are ideally shipping .d.ts files which would automatically have implementation comments removed, that more common scenario is basically already covered).
You could pretty reasonably use something like esprima to implement a post-compile step that conformed to the exact behavior you wanted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With