Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options allowJs and declaration don't play nice together #317

Closed
siggiorn opened this issue Apr 4, 2016 · 2 comments
Closed

Options allowJs and declaration don't play nice together #317

siggiorn opened this issue Apr 4, 2016 · 2 comments

Comments

@siggiorn
Copy link

siggiorn commented Apr 4, 2016

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

@ivogabe
Copy link
Owner

ivogabe commented Apr 4, 2016

Looks like a duplicate of microsoft/TypeScript#7546

@siggiorn
Copy link
Author

siggiorn commented Apr 5, 2016

I think you're right, I hope they add support for that soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants