【问题标题】:Typescript can't find basic types in Angular2 Meteor appTypescript 在 Angular2 Meteor 应用程序中找不到基本类型
【发布时间】:2016-07-08 06:12:19
【问题描述】:

每当我使用Date 时,我都会在编译时收到此错误:

找不到名称“日期”

这是一个用法示例:

var pastEvents = Events.find({ timestamp: { $lt: new Date() }});

注意事项:

  • 同样的事情发生在
  • 这是一个 Angular2 Meteor 应用程序
  • 我没有在顶部导入任何东西,所以如果我需要,那就是问题所在。
  • stringnumber 和任何其他基本类型也会发生同样的情况。

我可以列出类型、我的 tsconfig.json 文件或您需要的任何其他信息。请告诉我。

【问题讨论】:

    标签: typescript angular angular2-meteor


    【解决方案1】:

    你的打字安装正确吗?

    $ sudo npm install typings -g
    $ typings init
    $ typings install es6-promise --save
    $ typings install dt~es6-shim --global --save
    $ typings install registry:env/meteor --global
    

    由于即使是标准类型也会出现错误,您可能希望将 tsconfig 和其他设置与此 angular2-meteor 基础应用程序进行比较: https://github.com/bsliran/angular2-meteor-base

    【讨论】:

      猜你喜欢
      • 2016-09-15
      • 2021-11-27
      • 2020-07-04
      • 2016-04-24
      • 2017-05-11
      • 2016-05-15
      • 2018-06-16
      • 1970-01-01
      • 2019-01-03
      相关资源
      最近更新 更多