typescript - 我应该使用 tsd 还是 typings?

标签 typescript angular tsd

我想知道 Angular 团队推荐的做法是什么?我在文档的任何地方都找不到它,我想知道两者之间有什么区别。任何见解都非常受欢迎!

最佳答案

看来情况又要发生变化了。据我了解,Typescript 2.0 将使用 npm(节点包管理器)来管理现有 Javascript 库的 Typescript 声明。

给出的例子是你可以这样做:

npm install --save @types/lodash

接下来会做两件事:

  1. 获取 lodash 的声明文件并将其保存到我们包的 node_modules 中名为 @types/lodash 的目录中。
  2. 将其保存为我们的 package.json 中的依赖项

有关详细信息,请参阅 Microsoft 的此公告:The Future of Declaration Files

还有这个 Github 问题:Improve Declaration File Acquisition .

关于typescript - 我应该使用 tsd 还是 typings?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36327155/

相关文章:

typescript - 类型 'noUiSlider' 上不存在属性 'HTMLElement'

typescript - 如何避免从项目的父目录而不是 node_modules 解析 TypeScript 模块?

events - Ionic2 切换组件更改事件未触发

typescript - 更新到Angular2.0.0-rc.1,无法通过这个错误

angular - 如何将JSON格式的blob数据转换为图像并以 Angular 显示

用于 google web 登录的 TypeScript 绑定(bind)

typescript - gulp typescript 抛出错误 TS2300 : Duplicate identifier 'moment'

html - 如何在 Angular 中为整个应用程序使用样式 angular 4

javascript - 为什么它显示为未定义/NaN?

angular - 如何在单元测试 Angular 代码时模拟窗口导航器对象