This project is read-only.

Reference comment tag should not impact command line utility output.

Topics: Language Specification
Jun 3, 2014 at 7:32 PM
Edited Jun 3, 2014 at 7:33 PM
Currently the reference can be used to impact what the tsc command line utility compiles to javascript. This is done by utilizing a comment.

/// <reference path="SomeFile.ts" />

This is helpful when working with internal typescript modules as the command line utility will then also generate the javascript for SomeFile.ts. To users that do not use the Visual Studio IDE this tag is just a comment. I feel it would empower non Visual Studio IDE users more if there was another way to reference an internal typescript reference other than using a comment. The "import" keyword is nice, but can only be used for external modules. The import keyword could most likely be expanded to work for this internal case, or cases where references are made, but an AMD type loader is not utilized.
Jun 3, 2014 at 7:39 PM
Jun 3, 2014 at 7:51 PM
Just to add (FYI): Another issue for some may be that all the 'reference' comment lines are included in the resulting JS, which people may not want.
Jun 3, 2014 at 7:55 PM
The --removeComments flag works for removing the comment lines afterwards.
Jun 3, 2014 at 8:26 PM
And if you WANT comments in there, but not the .TS references? ;)
Jun 3, 2014 at 9:26 PM
I think TypeScript could become very powerful if support was added to include other modules much like C# does with the "using" keyword. I don't think many other programming languages use comments to handle anything important. When I brought up removeComments I thought of your point jamesnw, it is just one of the many examples of why having something important in the comments becomes a hassle. When you don't use Visual Studio it just looks really awkward when it shows up as a common but is trying to accomplish what "using" would.
Jun 3, 2014 at 10:50 PM
Edited Jun 4, 2014 at 10:26 PM
Since JSDoc is supported, I'm surprised they didn't do something like this:
 * @reference "SomeFile1.ts"
 * @reference "SomeFile2.ts"
Other discussions on this: