Description
When compiling with gulp-typescript I receive the error
error TS2304: Cannot find name 'Promise' (or Set or Map)
Having researched this issue I discovered the new TS compilerOption typeRoots.
http://stackoverflow.com/questions/35660498/angular-2-cant-find-promise-map-set-and-iterator
Properly setting this option in tsconfig.json and manually executing tsc, I no longer receive this error message. Unfortunately gulp-typescript does not support typeRoots.
Expected behavior:
Compile w/o error TS2304
Actual behavior:
/home/mike/Projects/rsvt/node_modules/@angular/core/src/facade/collection.d.ts(16,25): error TS2304: Cannot find name 'Map'.
[15:48:20] TypeScript error: /home/mike/Projects/rsvt/node_modules/@angular/core/src/facade/collection.d.ts(16,25): error TS2304: Cannot find name 'Map'.
/home/mike/Projects/rsvt/node_modules/@angular/core/src/facade/collection.d.ts(101,41): error TS2304: Cannot find name 'Set'.
[15:48:20] TypeScript error: /home/mike/Projects/rsvt/node_modules/@angular/core/src/facade/collection.d.ts(101,41): error TS2304: Cannot find name 'Set'.
Your gulpfile:
Include your gulpfile, or only the related task (with ts.createProject
).
gulp.task('ts', function() {
var src = config.appDir + '**/*.ts';
log('Compiling ' + src);
var tsProject = $.typescript.createProject(config.tsconfig);
return gulp
.src(src)
.pipe($.plumber({
errorHandler: error
}))
.pipe($.if(args.verbose, $.print()))
.pipe($.if(config.sourcemaps, $.sourcemaps.init()))
// .pipe($.typescript(tsProject))
.pipe(tsProject())
.pipe($.if(config.sourcemaps, $.sourcemaps.write('.')))
.pipe(gulp.dest(config.appDir));
});
tsconfig.json
Include your tsconfig, if related to this issue.
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"typeRoots": [
"node_modules/@types"
]
},
"types": [ "core-js" ],
"exclude": [
"node_modules",
"bower_components",
"src/jspm_packages",
"typings/main",
"typings/main.d.ts"
]
}
It would appear my problem is similar to
lib compilerOptions not used? #420
but resolved using a different TS 2.0 supported config option.