gulp-typescript
gulp-typescript copied to clipboard
How to ignore errors from gulp-typescript?
I have a legacy project with broken/missing types, but I want to emit the code anyway.
Here's a small bit of code:
function tsPipeline(src, dst, extraLibs) {
return function () {
const build = gulp.src(src).pipe(
ts({
target: "es5",
module: "commonjs",
declaration: true,
noImplicitAny: true,
removeComments: true,
experimentalDecorators: true,
newLine: "LF",
lib: [
"DOM",
"DOM.Iterable",
"ScriptHost",
"es2016",
"es2017.sharedmemory",
],
})
);
return merge([
build.dts.pipe(gulp.dest(dst)),
build.js.pipe(gulp.dest(dst)),
]);
};
}
Is there a way to make this function tsPipeline not crash the task it belongs to, even if there are errors in the types? I know this is bad practice, but I just need to get this old legacy code to build regardless of the cost.
I have the same problem, have you solved yet?
Add .on("error", () => { /* Ignore compiler errors */}) at end of build:
function tsPipeline(src, dst, extraLibs) {
return function () {
const build = gulp.src(src).pipe(
ts({
target: "es5",
module: "commonjs",
declaration: true,
noImplicitAny: true,
removeComments: true,
experimentalDecorators: true,
newLine: "LF",
lib: [
"DOM",
"DOM.Iterable",
"ScriptHost",
"es2016",
"es2017.sharedmemory",
],
})
).
on("error", () => { /* Ignore compiler errors */});
return merge([
build.dts.pipe(gulp.dest(dst)),
build.js.pipe(gulp.dest(dst)),
]);
};
}