Skip to content
This repository has been archived by the owner on Dec 1, 2019. It is now read-only.

tsconfig "declaration": true doesn't produce declaration files #349

Closed
quantuminformation opened this issue Jan 12, 2017 · 6 comments
Closed

Comments

@quantuminformation
Copy link

I did this with ts-loader in the same repo and it works(produces /src)

image

@chiefmc
Copy link

chiefmc commented Jan 13, 2017

Same here... Can't get this to work with awesome-typesctipt-loader

@mblandfo
Copy link

mblandfo commented Jan 24, 2017

Yep. Trying to upgrade from 2.2.4 makes my .d.ts file almost empty... and 2.2.4 doesn't work with the latest typescript version: #293

@MeirionHughes
Copy link

pretty much having to run a separate gulp build just for the declarations; ts-loader isn't great either and cannot exlcude test files. :/

@quantuminformation
Copy link
Author

Hmm I was just about to add tests with ts-loader, are you sure about this @MeirionHughes ?

@quantuminformation
Copy link
Author

isn't there a spec in ts that tells tsc to ignore a file, like naming with _test in the filename?

@MeirionHughes
Copy link

MeirionHughes commented Jan 25, 2017

@quantuminformation

rules: [ { test: /\.ts?$/, exclude: [ path.resolve(__dirname, "test")], loader:"ts-loader"], ... 

... had no effect.
Unfortunately, I cannot use exclude in the tsconfig because its used used by ts-node + mocha for testing.
In addition: rather than get ./lib/index.d.ts I'm getting ./lib/src/index.d.ts et al

I tried getting tsc to emit only the declarations, but that didn't work. In the end, it was simply easier to gulp it:

var gulp = require('gulp');
var gulpts = require('gulp-typescript');
var typescript = require('typescript');

gulp.task('typings', () => {
  var project = gulpts.createProject('tsconfig.json', {
    typescript: typescript
  });
  return gulp.src(['src/**/*.ts']).pipe(project()).dts.pipe(gulp.dest('./lib'));
});

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

No branches or pull requests

4 participants