ivogabe / gulp-typescript

A TypeScript compiler for gulp with incremental compilation support.
MIT License
839 stars 129 forks source link

Exclude angular material type definition files error #558

Closed vmrathod closed 6 years ago

vmrathod commented 6 years ago

I am using gulp-typescript v^3.2.4 and my gulp file configuration like

const gulp = require('gulp');
const gulpTypeScript = require('gulp-typescript');
const tsProject = gulpTypeScript.createProject("tsconfig.json");

gulp.task('compile-typescripts', function () {
        var tsResult = gulp.src("./App/**/*.ts") // or tsProject.src()
        .pipe(tsProject());
       return tsResult.js.pipe(gulp.dest('./App/'));
});

And my tsconfig.json file is

{
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "module": "commonjs",
    "moduleResolution": "node",
    "noEmitOnError": false,
    "noImplicitAny": false,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5"
  },
  "exclude": [
    "node_modules",
    "typings/index.d.ts"

  ]

}

and my package.json file is

{
  "version": "1.0.0",
  "name": "testproject",
  "scripts": {
    "build": "gulp build",
 },
   "dependencies": {
    "@angular/animations": "^5.2.2",
    "@angular/cdk": "^5.1.0",
    "@angular/common": "~4.3.4",
    "@angular/compiler": "~4.3.4",
    "@angular/core": "~4.3.4",
    "@angular/forms": "~4.3.4",
    "@angular/http": "~4.3.4",
    "@angular/material": "^5.1.0",
    "@angular/platform-browser": "~4.3.4",
    "@angular/platform-browser-dynamic": "~4.3.4",
    "@angular/router": "~4.3.4",
    "@angular/upgrade": "~2.2.0",
    "angular-in-memory-web-api": "~0.1.15",
    "angular2-cookie": "1.2.4",
    "body-parser": "1.14.1",
    "bootstrap": "^3.3.6",
    "core-js": "^2.4.1",
    "es6-shim": "^0.35.1",
    "file-saver": "^1.3.3",
    "hammerjs": "^2.0.8",
    "jquery": "2.1.4",
    "ngx-filesaver": "0.0.2",
    "reflect-metadata": "^0.1.8",
    "replace": "^0.3.0",
    "rxjs": "5.0.1",
    "systemjs": "0.19.39",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "concurrently": "^3.0.0",
    "del": "2.2.0",
    "fs": "^0.0.1-security",
    "gulp": "^3.9.1",
    "gulp-bump": "^2.4.0",
    "gulp-compass": "^2.1.0",
    "gulp-html-replace": "^1.6.2",
    "gulp-ng-config": "^1.3.1",
    "gulp-replace": "^0.5.4",
    "gulp-replace-task": "^0.11.0",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-typescript": "^3.2.4",
    "gulp-watch": "4.3.6",
    "lite-server": "^2.2.2",
    "merge": "1.2.0",
    "merge-stream": "^1.0.1",
    "tslint": "3.11.0",
    "typings": "^0.8.1",
    "underscore": "^1.8.3",
    "yargs": "^6.2.0",
    "typescript": "~2.1.0"
  }
}

When i run the "compile-typescript" task from gulp file I am getting following error.

node_modules/@angular/material/dialog/typings/dialog-config.d.ts(27,40): error TS1005: ',' expected.
node_modules/@angular/material/dialog/typings/dialog-ref.d.ts(16,40): error TS1005: ',' expected.
node_modules/@angular/material/dialog/typings/dialog.d.ts(55,15): error TS1005: ',' expected.
....more errors....

Does this issue related to any typescript version issue? Please guide me to resolve this issue.

ivogabe commented 6 years ago

It's by design that the exclude field will not exclude those files, see the Common Questions section of https://www.typescriptlang.org/docs/handbook/module-resolution.html. The errors that you get are caused by the old version of TypeScript that you're using (2.1). Can you try to update to a more recent version?