将 gulp-typescript 从 2 升级到 3 会导致未知的编译器选项

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

将 gulp-typescript 从 2 升级到 3 后,我开始遇到这些错误。

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.

我不知道为什么。我没有那些编译器选项。

我已经完成了 upgrade guide,但没有帮助。

字符串,_readableState 等,似乎源自包含的 npm 包 readable-stream

这发生在 Windows 10 和 Windows Server 2008R2 机器上。

Gulpfile.js 的相关部分如下所示

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("./"));
});

我已将此报告为 issue on gulp-typescript

我现在意识到我没有正确升级tsProject语法,以下工作

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("./"));
});