hgiesel
hgiesel

Reputation: 5658

How does tsc get its definitions when using npm definitions

So I settled from using typings to just using npm. So you have the @types directory in node_modules, but besides that, there are no additional files.

With typings I always had to include the index.d.ts file in typings, but using npm this is not necessary. I want to ask why this is the case.

Does npm use some kind of hidden feature of tsc or did Microsoft and the people behind npm agree to something?

Upvotes: 2

Views: 39

Answers (1)

Max Koretskyi
Max Koretskyi

Reputation: 105547

Yes, tsc automatically checks ./node_modules/@types. Take a look:

By default all visible “@types” packages are included in your compilation. Packages in node_modules/@types of any enclosing folder are considered visible; specifically, that means packages within ./node_modules/@types/, ../node_modules/@types/, ../../node_modules/@types/, and so on.

Upvotes: 1

Related Questions