错误:调试失败。假表达式:打字稿升级到2.1.1时出现意外的节点

时间:2016-12-06 08:19:02

标签: angularjs typescript webpack

当我将typescript从2.0.3升级到2.1.1时,得到错误:

 [at-loader] Using typescript@2.1.1 from typescript and "tsconfig.json" from /Users/zhouweiming/data/project/iermu_opssite/src/tsconfig.json

/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.1.1/lib/typescript.js:59508
            throw e;
            ^

Error: Debug Failure. False expression: Unexpected node.
Verbose Debug Information: Node 94 (NullKeyword) was unexpected.
at Object.assert (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.1.1/lib/typescript.js:3001:23)
at Object.Debug.failBadSyntaxKind (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.1.1/lib/typescript.js:42746:55)
at serializeTypeNode (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.1.1/lib/typescript.js:44666:30)
at serializeTypeNode (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.1.1/lib/typescript.js:44637:56)
at serializeTypeOfNode (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.1.1/lib/typescript.js:44498:28)
at serializeParameterTypesOfNode (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.1.1/lib/typescript.js:44550:42)
at addOldTypeMetadata (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.1.1/lib/typescript.js:44425:136)
at addTypeMetadata (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.1.1/lib/typescript.js:44416:17)
at transformAllDecoratorsOfDeclaration (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.1.1/lib/typescript.js:44241:13)
at generateConstructorDecorationExpression (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.1.1/lib/typescript.js:44351:40)

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "inlineSources": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false,
    "suppressImplicitAnyIndexErrors": true,
    "lib": ["dom", "es6", "es2015"],
    "rootDirs": ["./"],
    "skipLibCheck": true,
    "strictNullChecks": false,
    "noUnusedParameters": false,
    "noUnusedLocals": false,
    "typeRoots": [
      "./node_modules/@types"
    ]
  },
  "files": [
    "./public/*"
  ],
  "compileOnSave": true,
  "exclude": [
    "node_modules/*",
    "config/helpers.js",
    "config/webpack.common.js",
    "config/webpack.dev.js",
    "config/webpack.prod.js",
    "webpack.config.js",
    "gulpfile.js"
  ]
}

other env

  • webpack:1.13.3
  • node:7.2.0
  • angular:2.2.4
  • awesome-typescript-loader:3.0.0-beta.9

在我的项目中,当我在Class定义之前使用@Injectable()时,vscode输出错误:

 [ts] Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.

当我在所有代码中删除@Injectable()装饰器时,编译我的项目时所有错误都会消失,但在浏览器中运行失败,因为注入模块失败。

0 个答案:

没有答案