1

Having a multi file typescript project, using external modules.

If I compile with

tsc -d init.ts -m "commonjs"

Then all the files of the project get their own .d.ts file. But I would like to generate one single .d.ts file for the whole project. What's the best way to go about this?

Flion
  • 10,468
  • 13
  • 48
  • 68
  • 1
    https://github.com/TypeStrong/dts-bundle seems to contain an answer or initial code base for your own solution – xmojmr Nov 21 '14 at 17:56

3 Answers3

1

But I would like to generate one single .d.ts file for the whole project. What's the best way to go about this?

At the moment it is handled in a hacky way by : https://github.com/TypeStrong/grunt-dts-bundle

More : https://github.com/Microsoft/TypeScript/issues/1236

basarat
  • 261,912
  • 58
  • 460
  • 511
1

You can generate a single d.ts and a .ts and .js bundle using the npm package TsProject.

Todd Thomson
  • 62
  • 1
  • 4
0

Have a look at "npm-dts" package. I think it does exactly what you need.

Also, there is a plugin for WebPack called "npm-dts-webpack-plugin".

RandomX
  • 189
  • 1
  • 3