There was a time not too long ago when everything was running smoothly, but now I'm at a loss as to what has changed (other than updating to ASP.NET Core RC2 and adding some extensions for VS2015).
The problem arises when I run a Gulp task from VS2015 to compile my typescript files. If there's an error, all it shows is:
[10:02:54] Compiling typescript into javascript
[10:02:56] TypeScript: 1 semantic error
[10:02:56] TypeScript: emit succeeded (with errors)
[10:02:56] Finished 'compile' after 2.47 s
Process terminated with code 0.
without providing any details about the actual error.
Running in CMD:
$ tsc -v
Version 1.8.10
In Package Manager console of VS2015:
PM> tsc -v
Version 1.8.10
I believe that VS2015 is using the same typescript compiler in PATH, which should not be a problem. I've also tested with version 1.7 and encountered the same issue.
My gulp task looks like this:
gulp.task('compile', function () {
log('Compiling typescript into javascript');
return gulp
.src(config.allts)
.pipe($.sourcemaps.init())
.pipe($.typescript({
noImplicitAny: true,
target: 'ES5'
}))
.pipe($.sourcemaps.write('.'))
.pipe(gulp.dest(config.compileFolder));
});
And I'm using:
"gulp-typescript": "2.10.0"
although I have tested with the latest version:
"gulp-typescript": "2.13.4"
but with no success.
My understanding is that I shouldn't need a tsconfig.json file at the root of my project since I'm using gulp-typescript
and passing the compilerOptions in the gulp task itself. Therefore, I removed the tsconfig.json file I had because it wasn't being utilized.
If I remove all the compilerOptions from my gulp task:
gulp.task('compile', function () {
log('Compiling typescript into javascript');
return gulp
.src(config.allts)
.pipe($.sourcemaps.init())
.pipe($.typescript({
//removed
}))
.pipe($.sourcemaps.write('.'))
.pipe(gulp.dest(config.compileFolder));
});
I encounter more semantic errors without descriptions.
[10:12:57] Compiling typescript into javascript
[10:13:00] TypeScript: 184 semantic errors
[10:13:00] TypeScript: emit succeeded (with errors)
[10:13:01] Finished 'compile' after 3.83 s
Process terminated with code 0.
confirming that the options are indeed being used.
In CMD, if I navigate to the folder containing a typescript file and try compiling it with:
C:/>Sample/app> tsc mytestfile.ts
I can see all typescript compilation errors properly.
Can anyone help diagnose what might be wrong with my setup in VS2015 or gulp-typescript?
UPDATE: Switched to gulp-tsc from gulp-typescript and everything works fine. The issue seems to be with gulp-typescript
gulp.task('compile', function () {
log('Compiling typescript into javascript');
return gulp
.src(config.allts)
.pipe($.sourcemaps.init())
.pipe($.tsc({
noImplicitAny: true,
target: 'ES5'
}))
.pipe($.sourcemaps.write('.'))
.pipe(gulp.dest(config.compileFolder));
});