This project is read-only.


Ambient module declaration for "export assignment"-style modules


Even though it is now possible to export a single value from a module, like this:
    export = $;
It is still not possible to declare such module in a d.ts file.
The spec doesn't discuss any syntax to do this.
Just to be sure, I've actually tried a few obvious variations:
declare module "jQuery": JQueryStatic; 
declare module "jQuery" { export: JQueryStatic; }
declare module "jQuery" { export = <JQueryStatic>null; }
None of these attempts worked.
Closed Jul 12, 2013 at 1:13 AM by danquirk
You simply write export= in the declaration file. You can use the --declarations flag on the compiler to automatically generate the .d.ts for a file that uses export= to see what it looks like. For example,
class C {
    foo() {}

generates this .d.ts
declare class C {
    public foo(): void;
export = C;