首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >编译TypeScript源获取TS1005时出错

编译TypeScript源获取TS1005时出错
EN

Stack Overflow用户
提问于 2022-06-08 12:22:51
回答 1查看 298关注 0票数 0

我能够在VS2022中很好地运行我的应用程序,但是当我尝试运行gulp并编译TypeScript源代码时,我会得到如下所示的所有这些错误。我的tsconfig和包在下面,我不确定是否需要更改gulp脚本。

C:/WebProjects/ITF/Web/node_modules/typescript/lib/lib.es6.d.ts(20624,14):

错误TS1005:';‘预期。C:/WebProjects/ITF/Web/node_modules/typescript/lib/lib.es6.d.ts(20625,14):错误TS1005:';‘预期。C:/WebProjects/ITF/Web/node_modules/typescript/lib/lib.es6.d.ts(20626,14):错误TS1005:';‘预期。

编译TypeScript源代码

代码语言:javascript
复制
gulp.task("compile", gulp.series("clean", function () {
    const stream = gulp.src("./App/**/*.ts")
        .pipe(inlineNg2Template({
            base: "/",                  // Angular2 application base folder
            target: "es6",              // Can swap to es5
            indent: 2,                  // Indentation (spaces)
            useRelativePaths: false,     // Use components relative assset paths
            removeLineBreaks: false,     // Content will be included as one line
            templateExtension: ".html", // Update according to your file extension
            templateFunction: false    // If using a function instead of a string for `templateUrl`, pass a reference to that function here
        }))
        .pipe(typescript(tsProject))
        .pipe(ignore("References.js"))
        .pipe(gulp.dest("dist/App"));
    return stream;
}));

tsConfig

代码语言:javascript
复制
{
  "compilerOptions": {
    "target": "es5",
    "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
}

套餐

代码语言:javascript
复制
 "dependencies": {
    "@angular/cli": "^6.2.1",
    "@angular/common": "4.4.7",
    "@angular/compiler": "4.4.7",
    "@angular/core": "4.4.7",
    "@angular/forms": "4.4.7",
    "@angular/http": "4.4.7",
    "@angular/platform-browser": "4.4.7",
    "@angular/platform-browser-dynamic": "4.4.7",
    "@angular/router": "4.4.7",
    "@angular/upgrade": "4.4.7",
    "a": "^2.1.2",
    "angular-in-memory-web-api": "0.2.5",
    "core-js": "^2.4.1",
    "debug": "^4.1.1",
    "gulp": "^4.0.2",
    "gulp-cli": "^2.3.0",
    "gulp-typedoc": "^1.2.1",
    "gulp4-run-sequence": "^1.0.1",
    "moment": "2.17.1",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.4.3",
    "systemjs": "0.19.39",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "gulp-comment-swap": "0.0.10",
    "gulp-concat": "^2.6.0",
    "gulp-htmlclean": "^2.7.22",
    "gulp-ignore": "^2.0.1",
    "gulp-inject": "^5.0.5",
    "gulp-inline-ng2-template": "^5.0.1",
    "gulp-insert": "^0.5.0",
    "gulp-jspm": "^0.5.13",
    "gulp-rename": "^1.2.2",
    "gulp-replace": "^0.5.4",
    "gulp-rimraf": "^0.2.0",
    "gulp-shell": "^0.8.0",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-tslint": "^8.1.4",
    "gulp-tslint-stylish": "^1.1.1",
    "gulp-typescript": "^2.13.0",
    "gulp-uglify": "^3.0.2",
    "gulp-util": "^3.0.2",
    "gulp-watch": "^4.0.1",
    "highcharts": "^10.0.0",
    "html-loader": "^0.4.0",
    "immutable": "^3.8.1",
    "install": "^0.4.1",
    "json-loader": "^0.5.3",
    "moment": "^2.29.2",
    "npm": "^8.6.0",
    "redux": "^3.5.2",
    "rimraf": "^2.4.4",
    "run-sequence": "^1.1.5",
    "superstatic": "^7.1.0",
    "ts-loader": "^0.7.2",
    "tsc": "^1.20150623.0",
    "tsconfig-lint": "^0.12.0",
    "tslint": "^3.2.1",
    "tslint-loader": "^2.1.0",
    "typedoc": "^0.2.2",
    "typescript": "2.7.2",
    "typings": "^1.3.2"
  }
EN

Stack Overflow用户

发布于 2022-06-16 19:04:30

我只是猜测,但我看到您使用的是旧版本的gulp-typescript。你介意试试新版本吗?当然,这也可能迫使您更新其他一些包,但问题可能与使用旧版本的tsc的包有关。见-> TypeScript error TS1005: ';' expected (II)

票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72545641

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档