[英]Angular 4.4.7 Typescript 2.7.2 Getting TS1005: ';'
I am unable to build my project getting a lot of errors about lib.es6.d.ts
我无法构建我的项目,得到很多关于
lib.es6.d.ts
的错误
node_modules/typescript/lib/lib.es6.d.ts(20605,14): error TS1005: ';'
node_modules/typescript/lib/lib.es6.d.ts(20605,14): 错误 TS1005: ';' expected.
预期的。
tsconfig.json tsconfig.json
{
"compilerOptions": {
"target": "es6",
"module": "amd",
"moduleResolution": "node",
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noEmitHelpers": false,
"sourceMap": true,
"noResolve": false,
"noEmitOnError": true,
"outDir": "dist/debug"
},
"filesGlob": [
"./**/*.ts",
"!./node_modules"
],
"exclude": [
"node_modules",
"jspm_packages",
"typings",
"dist",
"typings/*",
"typings/main.d.ts",
"typings/main",
"Scripts"
],
"compileOnSave": true,
"buildOnSave": true
}
npm ls typescript npm ls 打字稿
+-- @angular/cli@6.2.9
| `-- @schematics/angular@0.8.9
| `-- typescript@2.9.2 deduped
+-- gulp-typedoc@1.2.1
| `-- typedoc@0.3.12
| `-- typescript@1.6.2
+-- gulp-typescript@2.14.1
| `-- typescript@1.8.10
+-- tslint@3.15.1 invalid: ">=5.0.0-dev" from node_modules/gulp-tslint
| `-- typescript@2.9.2 deduped
+-- typedoc@0.2.3
| `-- typescript@1.4.1
+-- typescript@2.9.2
`-- typings@1.5.0
`-- typings-core@1.6.1
`-- typescript@2.9.2 deduped
PS C:\WebProjects\COTT\COTT\OrderTemplateTool.Web> PS C:\WebProjects\COTT\COTT\OrderTemplateTool.Web>
I looks like you might have some mismatching versions of angular.我看起来你可能有一些不匹配的角度版本。 Your title says Angular version 4.4.7.
您的标题显示 Angular 版本 4.4.7。 Your tree says angular-cli 6.2.9 and you typescript version on 2.7.2.
你的树说 angular-cli 6.2.9,你的打字稿版本是 2.7.2。 Typescript requirements are going to be different for angular and angular-cli.
angular 和 angular-cli 的 Typescript 要求会有所不同。 I would align those versions first by either downgrading cli or upgrading angular.
我会首先通过降级 cli 或升级 angular 来对齐这些版本。 Then wipe your node_modules folder and do a fresh npm install.
然后擦除你的 node_modules 文件夹并重新安装 npm。 Helpful tool for angular/angular-cli upgrades HERE
用于 angular/angular-cli 升级的有用工具这里
Type inference in conditional types & Conditional Types in typescript only gets added in 2.8 release.条件类型中的类型推断和打字稿中的条件类型仅在 2.8 版本中添加。 Prior release don't support this.
之前的版本不支持这个。
I have reproduced your issue with this playground .我已经在这个操场上复制了你的问题。 I have selected 2.7.2 as typescript version & can see exact error which you are seeing.
我已选择 2.7.2 作为打字稿版本,并且可以看到您所看到的确切错误。
If I use typescript 2.8.1 as here , this error disappears.如果我在这里使用 typescript 2.8.1,这个错误就会消失。 So if you want support of conditional types in your code, you have to upgrade to 2.8.1 at least.
所以如果你想在你的代码中支持条件类型,你必须至少升级到 2.8.1。
Or you can completely remove conditional type declaration from your code.或者您可以从代码中完全删除条件类型声明。 Complete list of features which are introduced as a part of 2.8 are found here
作为 2.8 的一部分引入的功能的完整列表可在此处找到
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.