Wednesday, April 20, 2016

Angular 2 errors when compiling with Gulp

When attempting to use a Gulp script to compile my Angular 2, I was getting a lot of various errors in the output window. These included:
error TS2304: Cannot find name 'Promise'.
error TS2304: Cannot find name 'Map'.
error TS2304: Cannot find name 'Iterator'.
Adding 'node_modules/angular2/typings/browser.d.ts' to the Gulp src appeared to fix the error and the code compiled correctly.

return gulp
    .src(['node_modules/angular2/typings/browser.d.ts','src/app/**/*.ts'])
    .pipe(typescript(tscConfig.compilerOptions))
    .pipe(gulp.dest('dist/app'))

This is a source map file required for the code to compile.

No comments:

Post a Comment