【问题标题】:typescript and meteor: Cannot find name 'Meteor'打字稿和流星:找不到名称“流星”
【发布时间】:2019-11-08 00:49:58
【问题描述】:

我刚刚开始在我的流星项目中使用 Typescript。一切进展顺利,但有些细节我无法轻易纠正。其中之一是:每当我在代码中使用 Meteor (Meteor.call, Meteor.subscribe, ...) 这个词时,编译器都会抱怨说:

typescript 找不到名称“Meteor”。

我正在使用带有 typescript 包的 Atom,它似乎可以完美地接受 Meteor

当然该消息似乎是一个警告,因为编译并没有停止,构建过程完成,但该消息非常烦人。

我安装了 Meteor 类型定义,可以看到 node_modules 中有一个文件:

@types/meteor/meteor.d.ts

不应该在那里定义符号 Meteor 吗?

我似乎在这里遗漏了一些东西,但不知道是什么。

非常感谢您的帮助,再见...

【问题讨论】:

    标签: typescript meteor


    【解决方案1】:

    添加导入语句修复错误:

    import { Meteor } from 'meteor/meteor'
    
    // ...
    

    但这引入了另一个错误。 Cannot find module 'meteor/meteor'.,根据https://github.com/TypeStrong/atom-typescript/issues/1307,还没有修复。

    【讨论】:

      猜你喜欢
      • 2018-03-26
      • 2017-04-18
      • 1970-01-01
      • 1970-01-01
      • 2017-09-05
      • 2017-05-30
      • 1970-01-01
      • 2016-08-28
      • 1970-01-01
      相关资源
      最近更新 更多