构建:找不到名称'$'

时间:2017-07-11 11:53:22

标签: typescript visual-studio-2015

我正在使用VS2015。从TS 1.8升级到2.4.1后,TS无法找到打字文件。

Build:Cannot find name '$'.

tsconfig.json:

{
"compileOnSave": true,
"compilerOptions": {
"module": "none",
"allowJs": true,
"outFile": "app.js",
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": true,
"sourceMap": true,
"target": "es5"
}

我该怎么做才能解决这个问题?

1 个答案:

答案 0 :(得分:1)

通过列出tsconfig.json文件中的所有ts和typing文件来修复它:

{
  "compileOnSave": true,
  "compilerOptions": {
    "module": "none",
    "allowJs": true,
    "outFile": "Scripts/app.js",
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": true,
    "sourceMap": true,
    "target": "es5"
  },

  "files": [
    "Scripts/jquery.js",
    "Scripts/typings/jquery/jquery.d.ts",
    ...
    "Scripts/main.ts"
  ]
}