TypeStrong / dts-bundle

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

Consider optional "name" setting #34

Closed tsv2013 closed 8 years ago

tsv2013 commented 8 years ago

If "name" option is not defined, dts-bundle does not wrap output with module definition:

instead of

// Generated by dts-bundle v0.4.3

declare module 'MyBundle' {
    module Module1 {
        function validateGuid(guid: any): boolean;
    }
    module Module2 {
        function validateGuid(guid: any): boolean;
    }
}    

generate just

// Generated by dts-bundle v0.4.3

module Module1 {
    function validateGuid(guid: any): boolean;
}
module Module2 {
    function validateGuid(guid: any): boolean;
}
tolemac commented 8 years ago

Can you explain me a case of use where you need it?

Thanks.

tsv2013 commented 8 years ago

Now I feel like I've used wrong tool. I have a set of ".ts" files with internal modules. I combine them into a single resulting file, say "result.ts". I'd like to create a single corresponding "result.d.ts" file. And, in the "result.d.ts" I need no references ("/// <reference path=...") completely as well as simply combine internal modules, without wrapping them with another "main" module.

I've been expected "dts-bundle" as a tool for solving my tasks. May be I was wrong, and this is not your scenario. In this case you can simply close this issue.

Thanks

tolemac commented 8 years ago

Yes, this is not the scenario of dts-bundle.

When I need it I usually create "result.ts" file manually exporting the others modules. I usually have a "result.ts" file for each folder, see this example https://github.com/tolemac/ngts/blob/master/ngts.ts

It's exporting "decorators/decorators" and this is the code that module https://github.com/tolemac/ngts/blob/master/decorators.ts