typescriptgulp-typescript

Upgrading gulp-typescript from 2 to 3 leads to Unknown compiler option


After upgrading gulp-typescript from 2 to 3 I have started getting these errors.

error TS5023: Unknown compiler option '_readableState'.
error TS5023: Unknown compiler option 'readable'.
error TS5023: Unknown compiler option 'domain'.
error TS5023: Unknown compiler option '_events'.
error TS5023: Unknown compiler option '_eventsCount'.
error TS5023: Unknown compiler option '_maxListeners'.
error TS5023: Unknown compiler option '_writableState'.
error TS5023: Unknown compiler option 'writable'.
error TS5023: Unknown compiler option 'allowHalfOpen'.
error TS5023: Unknown compiler option 'js'.
error TS5023: Unknown compiler option 'dts'.
error TS5024: Compiler option 'project' requires a value of type string.

I have no idea why. I do not have those compiler options.

I have gone through the upgrade guide, but it hasn't helped.

The strings, _readableState etc., seem to originate from the included npm package readable-stream

This occurs on a Windows 10 and a Windows Server 2008R2 machine.

The relevant parts of the Gulpfile.js looks like this

var gulp = require("gulp");
var plugins = require("gulp-load-plugins")({ lazy: false });

var tsProjectOptions = {
    removeComments: false,
    target: "ES5",
    module: "commonjs",
    noResolve: false,
    noImplicitAny: false
};

var tsProjectUnittests = plugins.typescript.createProject(tsProjectOptions);

var typescriptGlob = [
    "./**/*.ts", "!./node_modules/**", "!./packages/**"
];

gulp.task("compile-typescript", function() {
    return gulp.src(typescriptGlob)
        .pipe(plugins.sourcemaps.init())
        .pipe(plugins.typescript(tsProjectUnittests(plugins.typescript.reporter.longReporter())))
        .pipe(plugins.sourcemaps.write({
            sourceRoot: "./"
        }))
        .pipe(gulp.dest("./"));
});

I've reported this as an issue on gulp-typescript.


Solution

  • I now realize that I did not upgrade the tsProject syntax correctly, the following works

    gulp.task("compile-typescript", function() {
        return gulp.src(typescriptGlob)
            .pipe(plugins.sourcemaps.init())
            .pipe(tsProjectUnittests(plugins.typescript.reporter.longReporter()))
            .pipe(plugins.sourcemaps.write({
                sourceRoot: "./"
            }))
            .pipe(gulp.dest("./"));
    });