找不到' $'的类型定义文件

时间:2018-02-10 04:38:19

标签: angular typescript angular-material angular-cli angular5

我最近尝试将我的Angular 4项目升级到angular 5以便能够使用@ angular / material数据表功能,但在将所有角度依赖项升级到版本5之后构建我的应用程序时出错。

我收到错误:" ERROR错误TS2688:找不到' $'""

的类型定义文件

我正在使用angular-cli,这是我的package.json

class Category
  has_many :services
  has_many :orders, through: :services
end

构建时出错: enter image description here

是否有人遇到类似问题并找到解决方案?

1 个答案:

答案 0 :(得分:0)

发现问题。在我的tsconfig.app.json文件中,我在compilerOptions的types数组中包含了一个“$”。我不确定那是怎么做到的,但删除它解决了这个问题。

我基本上改变了

中的src / tsconfig.app.json文件
{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "module": "es2015",
    "baseUrl": "",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "types": ["JQuery", "$"]
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "module": "es2015",
    "baseUrl": "",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "types": ["JQuery"]
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}