简体   繁体   English

Angular 4.4.7 Typescript 2.7.2 获取 TS1005: ';'

[英]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.

相关问题 打字稿错误 TS1005: ';' 预期 - Typescript error TS1005: ';' expected 在 Nestjs 项目中运行 npm 后出现 TS1005 typescript 错误 - getting TS1005 typescript error after runing npm start in nestjs project Angular 7 node_modules/graphql-tag/lib/index.d.ts(2,57) 中的错误:错误 TS1005:“,”预期 - Angular 7 ERROR in node_modules/graphql-tag/lib/index.d.ts(2,57): error TS1005: ',' expected 绝对输入-> React包-> tsc 2.2.2错误TS1005,TS1128,TS1109和TS1136 - DefinitelyTyped -> React package -> tsc 2.2.2 error TS1005, TS1128, TS1109 and TS1136 node_modules/mongoose/node_modules/mongodb/mongodb.ts34.d.ts:3288:5 - 错误 TS1005: '?' 预期的 - node_modules/mongoose/node_modules/mongodb/mongodb.ts34.d.ts:3288:5 - error TS1005: '?' expected node_modules/@types/lodash/common/array.d.ts(37,24) 中的错误:错误 TS1005:';' 预期的 - ERROR in node_modules/@types/lodash/common/array.d.ts(37,24): error TS1005: ';' expected SPFx Webpart - node_modules/@types/ [prop types] 和 [react] index.d.ts:gulp 构建时加载“错误 TS1005” - SPFx Webpart - node_modules/@types/ [prop types] and [react] index.d.ts: loads of "error TS1005" on gulp build 错误 - [tsc] node_modules/@fluentui/react/lib/components/ContextualMenu/ContextualMenu.types.d.ts(13,35): 错误 TS1005: ';' 预期的 - Error - [tsc] node_modules/@fluentui/react/lib/components/ContextualMenu/ContextualMenu.types.d.ts(13,35): error TS1005: ';' expected 错误 node_modules/jest-diff/build/diffLines.d.ts(8,13):错误 TS1005:'=' 预期。 在嵌套 js 中 - error node_modules/jest-diff/build/diffLines.d.ts(8,13): error TS1005: '=' expected. in nest js 我在 node.js 中收到错误代码“,”预期 ts(1005) - I am getting an error code ',' expected ts(1005) in node.js
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM