Reputation: 1287
Prior to TS version 0.9 Visual Studio required all TypeScript files to reference their dependencies through /// <reference ... />. If reference was not correct or missed then error was thrown. Since v0.9 this behavior was changed: now Visual Studio discovers all available TS files automatically and does not throw any errors (obviously because it knows all the dependencies).
The problem that we encountered is files order. Without correct /// <reference ... /> Visual Studio produces incorrectly concatenated result file which then results into JS errors.
For example, we have types Foo and Boo. Boo uses Foo. You would expect that Foo is declared before Boo but in fact declaration of Foo comes after Boo.
Of course we could use /// <reference ... /> even when VS does not actually need it and build process would work just fine. But since VS does not throw any error when use miss reference to required file, you never know if result file is correctly concatenated and type declarations are correctly ordered.
So, I'd like to know whether there is a way to disable this "auto discovery" mode and receive list of unresolved references. Or may be there is another work around that I could use?
BTW, we also tried TS gulp plugin and it produces correctly concatenated JS code. Unfortunately it is way slower than built-in VS TypeScript (5-6 sec vs. 1-2 sec). That is why we moved back to VS.
Upvotes: 2
Views: 742
Reputation: 1287
Thanks to one of the TS developers the solution was found (for reference check GitHub page). I must say that it was completely not obvious how to solve this problem and without TS developer I wouldn't even think that tsconfig.json can somehow alter Visual Studio plugin behavior (there are no information about this neither on TS website nor in blogs). So, once more thanks to Mohamed Hegazy who provided me with info :)
If you have same problem like I did, you have to do the following:
Upvotes: 1