Vincent J Vincent J - 1 month ago 6x
TypeScript Question

How are the definitions files loaded in typescript

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 ?


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.