Skip to content

No Definitions Generated #324

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

Closed
Ixonal opened this issue Apr 14, 2016 · 5 comments
Closed

No Definitions Generated #324

Ixonal opened this issue Apr 14, 2016 · 5 comments

Comments

@Ixonal
Copy link

Ixonal commented Apr 14, 2016

I'm having an issue where definition files aren't being generated. I read through a closed issue relating to this, but the points brought up in it doesn't seem to apply here. I have the "declaration" option set to true and I'm separately writing both streams. The javascript and sourcemaps are being generated properly, just no definitions. I tried doing an npm update to ensure everything is up to date and tried using a "project", but had the same issue. Any idea what's up?

Here's my build task

var gulp = require("gulp"),
    config = require("./config"),

    typescript = require("gulp-typescript"),
    plumber = require("gulp-plumber"),
    debug = require("gulp-debug"),
    rename = require("gulp-rename"),
    uglify = require("gulp-uglify"),
    sourcemaps = require("gulp-sourcemaps"),

    merge = require("merge2");

function build(globs) {
  var tsResult = gulp.src(globs)
                     .pipe(plumber())
                     .pipe(debug({ title: "Building" }))
                     .pipe(sourcemaps.init())
                     .pipe(typescript(config.settings.typescript));

  return merge([
    tsResult.dts.pipe(debug({ title: "Definition" }))
                .pipe(gulp.dest(config.locations.dts)),
    tsResult.js.pipe(uglify(config.settings.uglify))
               .pipe(debug({ title: "Distribution" }))
               .pipe(sourcemaps.write("."))
               .pipe(gulp.dest(config.locations.dist))
  ]);
}

gulp.task("build", function() {
  return build(config.globs.src);
});

exports.build = build;

Here are the typescript settings I'm using...

    typescript: {
      module: "system",
      declaration: true,
      removeComments: true,
      emitDecoratorMetadata: true,
      experimentalAsyncFunctions: true,
      experimentalDecorators: true,
      isolatedModules: true,
      allowJs: true,
      typescript: typescript
    }

the TypeScript version I'm pulling in is ^1.8.9

@ivogabe
Copy link
Owner

ivogabe commented Apr 14, 2016

It looks like the same issue as #317

@Ixonal
Copy link
Author

Ixonal commented Apr 14, 2016

As far as I can tell, these are two distinct issues (though, it may still be a typescript issue). The issue you linked looks to have to do with js files no longer being included if the declaration option is set to true. My issue is that no definition files are created. Just in case, I set allowJs to false in my config, and still no definitions are created.

Also, you might want to wait a bit to ensure that the issue is resolved instead of just assuming and closing immediately

@Ixonal
Copy link
Author

Ixonal commented Apr 14, 2016

Ah-hah! In turning things off at random, it looks like the issue is the "isolatedModules" setting being set to true. I turned that false, and it created the definitions. I'm not exactly sure WHY, but that's what's going on.

@ivogabe
Copy link
Owner

ivogabe commented Apr 16, 2016

Sorry, but I do not have unlimited time to handle these issues. So sometimes I must reply to them quickly. Your configuration wasn't working since allowJs and declaration cannot be used with each other (#317). isolatedModules cannot be used with declaration since isolatedModules disables type checking and type information is needed to generate the declaration files.

@Ixonal
Copy link
Author

Ixonal commented Apr 18, 2016

I get the finite time part, all I'm saying is it'd probably be a good idea to leave it open for long enough to confirm that's the issue and resolution.

Anyways, ok, I can see why that'd be an issue when creating the declaration files. Thanks for pointing that out.

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