Closed
Description
Expected behavior:
When using options.allowJs = true
both .js and .ts sources get transpiled. When you add the option options.declaration = true
, both .js and .ts sources should still get transpiled but now you should just also output definitions.
Actual behavior:
When you add the options.declaration = true
option, only .ts sources get transpiled and .js is ignored.
Your gulpfile:
var gulp = require('gulp');
var ts = require('gulp-typescript');
var merge = require('merge2'); // Require separate installation
function doGulp(declaration) {
var options = {
declaration: declaration,
allowJs: true,
noExternalResolve: true,
};
var tsResult = gulp.src('src/**/*.{ts,js}')
.pipe(ts(options));
return merge([
tsResult.dts.pipe(gulp.dest('release/definitions')),
tsResult.js.pipe(gulp.dest('release/js'))
]);
}
gulp.task('with-declarations', function() {
return doGulp(true);
});
gulp.task('without-declarations', function() {
return doGulp(false);
});
Reproducing the issue
I have created a small project that reproduces the issue very clearly:
https://github.com/siggiorn/typescript-gulp-definitions-issue
The readme explains how to reproduce