gulp-tsb icon indicating copy to clipboard operation
gulp-tsb copied to clipboard

gulp-tsb@3 refuses to output js files with allowJs

Open zenorbi opened this issue 6 years ago • 0 comments

Since gulp-tsb removes the outDir compiler at https://github.com/jrieken/gulp-tsb/blob/35f134ab384f5575628b152faa910389581bb4d8/src/builder.ts#L61 TypeScript thinks that the output file is the same as the source file and reports as:

[error] Cannot write file '/Users/zenorbi/Desktop/test/src/test.js' because it would overwrite input file. Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig.

TypeScript checks for this at https://github.com/Microsoft/TypeScript/blob/b1878e62bfeea57a926185e87449d89f34ba5742/src/compiler/program.ts#L2618 and can be suppressed by adding options.suppressOutputPathCheck = true; before https://github.com/jrieken/gulp-tsb/blob/35f134ab384f5575628b152faa910389581bb4d8/src/index.ts#L65

However this would use internal TypeScript options. Would you accept a PR for this?

zenorbi avatar Aug 09 '18 08:08 zenorbi