Is there any way to get the typescript compiler to search for declaration files in a given directory? Something like the INCLUDE_PATH for C++.
The . d. ts file is usually placed adjacent to the . ts file, it is providing the typings for.
The "d. ts" file is used to provide typescript type information about an API that's written in JavaScript. The idea is that you're using something like jQuery or underscore, an existing javascript library. You want to consume those from your typescript code.
Not currently.
You have to reference the file explicitly using:
///<reference path="path/to/file.d.ts" />
You can use the references.ts trick to ease the referencing in your program (just put all your references in a single file so all your other files just point to that one).
UPDATE
As of TypeScript 0.9.1, the Visual Studio template just gives you access to all of the TypeScript files and TypeScript definition files in your project. I have tested this and it works...
You can see the example and notes about this feature in my blog post.
Update for Visual Studio 2013 Update 3
I have updated the above article to point out that you must have the build action set to TypeScriptCompile
for a file to be included in this automatic discovery.
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