流星+ angular2:@types软件包不起作用

时间:2019-10-24 20:51:54

标签: typescript types typescript-typings angular-meteor typescript-types

我有一个angular2流星项目,当打字稿编译代码时,我无法删除所有警告。该代码可以工作,但是打字稿似乎找不到类型定义。

我已经安装了所有类型依赖项,例如:

"@types/meteor": "^1.4.27"

实际上只有此软件包才可以使用,但打字稿显示的警告如下:

Property 'call' does not exist on type 'typeof Meteor'

我试图在tsconfig.json中的编译器选项中添加“ types”,“ typeRoots”等,但是总是抛出相同的错误:“未知的编译器选项'types'”

如果我将@ types / meteor文件中的类型手动添加(复制粘贴)到我的Types.d.ts文件中,它将起作用

我还尝试添加一个index.d.ts来加载类型:

/// <reference path="./node_modules/@types/meteor/index.d.ts" />

但不起作用

我的tsconfig.json:

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5",
    "stripInternal": true,
    "noImplicitAny": false,
    "types": [//--> not working
      "meteor"
    ]
  },
  "include": [
    "client/**/*.ts",
    "server/**/*.ts",
    "imports/**/*.ts",
    "both/**/*.ts",
    "index.d.ts"
  ],
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": true,
  "atom": {
    "rewriteTsconfig": false
  }
}

还有我的index.d.ts文件(试图解决该问题,但实际上没有必要添加引用):

/// <reference path="./node_modules/moment/moment.d.ts" />
/// <reference path="./node_modules/@types/q/index.d.ts" />
/// <reference path="./node_modules/@types/lodash/index.d.ts" />
/// <reference path="./node_modules/@types/underscore/index.d.ts" />
/// <reference path="./node_modules/@types/node/index.d.ts" />
/// <reference path="./node_modules/@types/meteor/index.d.ts" />

对此有任何帮助吗?

预先感谢

0 个答案:

没有答案