microsoft / dts-gen

dts-gen creates starter TypeScript definition files for any module or library.
MIT License
2.43k stars 101 forks source link

NameSpace issue #151

Open Udhay-Thoutkatalyst opened 4 years ago

Udhay-Thoutkatalyst commented 4 years ago

Using dts-gen, i am generating a typescript definition file from JavaScript.

It is converting all the files properly, except namespace issue.

My JavaScript file looks like this....

var Utils = Utils || {};

Utils.SimpleDbClient = class SimpleDbClient {
}

When i convert i expect the following output (Used the following url to generate this. http://www.typescriptlang.org/play)

declare namespace Utils {
    export { SimpleDbClient };
}
declare class SimpleDbClient {
}

But i am getting the following one:

declare class Utils_SimpleDbClient {
}

I am using the following command to generate:

dts-gen --expression-file test.js

My question is, why dts-gen is not creating namespace?

Can you please help me to resolve this