TypeStrong / dts-bundle

Export TypeScript .d.ts files as an external module definition
MIT License
308 stars 57 forks source link

does not work with multi-file projects (+proposed solution) #14

Closed jasonswearingen closed 9 years ago

jasonswearingen commented 9 years ago

Hi, looks like dts-bundle works great for single file projects.

But unfortunately if a project has multiple files, the relative import references are not transformed.

for example, if my original input lib.d.ts is:

export import logging = require("./misc/logging")

Solution?

As I'm using grunt-dts-bundle, I think a solution might be to transform this file to something like

/// <reference path="./misc/ambient_misc_logging.d.ts" /> //add this line
declare module "ambient_lib" {
export import logging = require("ambient_misc_logging") //trim+prefiex + non-alphanumeric characters converted to underscore
}

and then I can walk my project, processing all my d.ts files this way, naming the dts-bundle output in a way that conforms with this additional transform.

basarat commented 9 years ago

A better solution is on the horizon : https://github.com/Microsoft/TypeScript/issues/2338

basarat commented 9 years ago

Hopefully we will not need dts-bundle soon

jasonswearingen commented 9 years ago

ok, hopefully it'll actually get solved. this issue has been on the typescript team's plate a long time :8ball: