typings vs @types NPM scope

2019-01-13 20:41发布

问题:

In some cases typings is used for handling TypeScript definitions (e.g. angular/angular2-seed).

In other cases scoped NPM @types packages are used with no typings involved (e.g. AngularClass/angular2-webpack-starter).

What are the practical differences between them? Does one of them offer benefits for TypeScript development that the other doesn't?

回答1:

@types is the new way to install the definitions in typescript 2.0. It unifies the management of definitions and packages. So that you do not need multiple tools and config files. Only going to need npm and package.json instead of having to have npm, package.json, typings, typings.json. It basically makes installing and managing definitions easier but it is the same as typings.

You can read more about it here: https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/