【问题标题】:how to use meteor package in typescript file如何在打字稿文件中使用流星包
【发布时间】:2015-11-23 16:22:31
【问题描述】:

我想在我的项目中使用this meteor package。我只是 Typescript 的初学者,所以对如何定义声明文件感到困惑。我希望能够这样做:

/// <reference to platform declaration file
console.log('os: ' + platform.os.toString());

关于如何定义这个包的声明文件的任何帮助。谢谢

【问题讨论】:

  • 显示您如何将包添加到项目中。这将提供一些线索。
  • 流星添加 snamoah:useragent
  • 你是说platformundefined的错误?
  • 我的打字稿编译器给Cannot find name 'platform'我不需要先定义它的声明文件吗?

标签: javascript meteor typescript typescript1.6


【解决方案1】:

根据this answerHow to import a js library without definition file in typescript file

尝试添加

/// <amd-dependency path="lib/platform">

到文件的顶部。

【讨论】:

  • 这意味着我不需要为这个模块定义打字稿声明文件?
猜你喜欢
  • 2016-08-28
  • 1970-01-01
  • 2016-09-21
  • 2017-05-13
  • 2017-05-28
  • 2018-04-14
  • 2016-11-01
  • 1970-01-01
  • 2019-07-18
相关资源
最近更新 更多