typescript 类型 vs @types NPM 范围
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39261204/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
typings vs @types NPM scope
提问by Estus Flask
In some cases typings
is used for handling TypeScript definitions (e.g. angular/angular2-seed).
在某些情况下typings
用于处理 TypeScript 定义(例如angular/angular2-seed)。
In other cases scoped NPM @types
packages are used with no typings
involved (e.g. AngularClass/angular2-webpack-starter).
在其他情况下@types
,使用不typings
涉及的范围 NPM包(例如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?
它们之间有什么实际区别?它们中的一个是否为 TypeScript 开发提供了另一个没有的好处?
回答by ordepim
@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.
@types 是在 typescript 2.0 中安装定义的新方法。它统一了定义和包的管理。这样您就不需要多个工具和配置文件。只需要 npm 和 package.json 而不是必须有 npm、package.json、typings、typings.json。它基本上使安装和管理定义更容易,但它与类型相同。
You can read more about it here: https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/
您可以在此处阅读更多相关信息:https: //blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/