The story behind the typings management ecosystem around TypeScript is very big.
First there was ( still is ) a monolith repository called DefinitelyTyped which was used as a hub to all developers that wanted to contribute their typings for different libraries.
Because of this repository a typings manager called tsd
which directly takes the typings from that repository and saves them locally in your project.
Meanwhile the DT repo exceeded it's scaling abilities and had to be restructured. The discussion went further in the way how a d.ts.
file should look like, so at one point there was a need for another way of including the typings in your project. Another problem was the versioning of libraries and TypeScript compiler itself.
Then at one point Blake Embrey created a new typings manager called typings
which had a support for DefinitelyTyped
and the new proposed way of structuring a d.ts
. The new structure allowed for two types of modules - globals ( most of the DefinitelyTyped ones ) and modules that are supposed to be encapsulated.
Later TypeScript 2.0 Beta was announced by Microsoft. The team behind TypeScript realized the need of a different way in handling typing files. What they did was a @types
npm scope, which they announced will be the new way of handling typings. At this point @types
only works with TypeScript 2.0.
Declaration files (.d.ts files) are a fundamental part of using existing JavaScript libraries in TypeScript, but getting them has always been a place where we’ve known there was room for improvement. As we get closer to TypeScript 2.0, we’re very excited to show off a sneak peak of our plan to simplify things. Getting type declarations in TypeScript 2.0 will require no tools apart from npm.
So to the answer of your question :
If you use TypeScript below v2.0 use typings
, but if you use 2.0 use @types