Reputation: 872
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.
Upvotes: 3
Views: 953
Reputation: 221114
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.
Upvotes: 2
Reputation: 803
As far as I know, the only option available to the TypeScript compiler is the -c
(or -comment
) which includes all comments. And I doubt that Web Essentials has its own TypeScript compiler.
Although, the feature you are suggesting isn't a bad one - it would simplify the process for library developers. Maybe you could suggest it over at the TypeScript Codeplex site?
Upvotes: 0