2

I'm trying to run a gulp task to compile my typescript but keep on getting errors related to dependencies.

/content/node_modules/@angular/core/src/facade/lang.d.ts(12,17): error TS2304: Cannot find name 'Map'.
/content/node_modules/@angular/core/src/facade/lang.d.ts(13,17): error TS2304: Cannot find name 'Set'.

I am trying to omit the node_modules directory so that it will only notify me of problems in my code. my files are as follows:

gulpfile.js

var tsProject = ts.createProject('tsconfig.json');
gulp.task('ts', function () {
    return gulp.src([aemPaths.jcrRoot + '**/*.ts'])
        .pipe(tsProject())
        .pipe(gulp.dest(aemPaths.jcrRoot));
});

I've also tried

gulp.task('ts', function () {
    return gulp.src([aemPaths.jcrRoot + '**/*.ts','!node_modules/**/*'])
        .pipe(tsProject())
        .pipe(gulp.dest(aemPaths.jcrRoot));
});

tsconfig.json

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "moduleResolution": "node",
        "sourceMap": false,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false,
        "noImplicitAny": false,
        "suppressImplicitAnyIndexErrors": true
    },
    "exclude": [
        "node_modules"
    ]
}

I've done many searches but can't seem to find a way to omit this with gulp-typescript. Any help would greatly be appreciated.

1 Answer 1

1

You don't need exlude node_modules directory into gulp, just add typings es6-collections and es6-promise into gulp.src array

Sign up to request clarification or add additional context in comments.

2 Comments

forgive me if I am miss understanding as this is all very new to me. I went ahead and installed the following: npm install --save-dev es6-promise es6-collections but still get the same typescript errors on compile.
@kisonay Use 'npm install typings' command. Install actual typings: 'typings install es6-collections'; 'typings install es6-promise'; then, into directory typings you will find index.d.ts. You need include this file inot your gulp.src

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.