What does /// <reference path="jquery-1.8.3.js" /> actually do?
That is a triple-slash directive for the Typescript compiler. Since tsc
will happily compile JS as well, this should work in either language and will reference a dependency.
The /// <reference .../>
directive shows a dependency (for compiler symbols) without necessarily importing and actually loading the file. That is useful when you have a large library (like React) that exports a lot of interfaces or type
symbols, but you don't want to actually include (since they might be vendored at runtime). From the docs:
The /// directive is the most common of this group. It serves as a declaration of dependency between files.
Triple-slash references instruct the compiler to include additional files in the compilation process.
This is most likely for Visual Studio's JavaScript intellisense. Mads Kristensen has a nice article you can read to learn more about the history of this and how to use it correctly.