in the past, d.ts files in typescript were only loaded when specifically required with a ///<reference path="...
statement. However, it's my understanding that this has changed recently and the compiler is now able to automatically load some local definition files. I have tried to find the rules for this by googling and browsing the TS specifications but with no success for the moment.
Anyone would be kind enough to explain theses rules or to point me in the right direction ?
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.
d. ts files. Those files are called declaration files and provide typescript type information about APIs of a package.
These days everyone uses tsconfig.json
, either original or atom-flavored (in Atom editor).
When using tsconfig.json
, you can omit files list and typescript compiler will compile all *.ts
files it will find in any subdirectory, including *.d.ts
.
Excluding files via exclude
is on the way, as well as files globbing.
If you don't want to use tsconfig.json
or need files globbing right now, you can achieve similar behavior using gulp
with gulp-typescript
and gulp-filter
.
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