"export as namespace" automatically in the declaration file

I have a small library ts, which is output as the UMD, and I will also automatically output files * .d.ts through TSconfig: "declaration": true.

The exported file looks like this:

export class Blue { 
    alert(): void {
        console.log('alerted');
    }
}

Using the exported UMD module declares a variable window.myLib.

The d.ts file looks like this:

export declare class Blue {
    alert(): void;
}

Now, either using webpack or using the typescript option that I did not find, I would also like to generate the following line in the d.ts file:

export as namespace myLib;

Is there any way to do this? Thanks.

+6
source share

No one has answered this question yet.

Source: https://habr.com/ru/post/1014746/


All Articles