Q:

Write d.ts file for JavaScript that exports a default function and a named export

Was attempting to write a d.ts file for worker-farm (https://github.com/rvagg/node-worker-farm) However I ran across an issue.
worker-farm does a module.exports like this:
module.exports     = farm
module.exports.end = end

If I try to do this in typescript such as
export function end(workers:any):void;
export =  workerFarm;

I receive an error saying I can't mix export types.  Trying to use default seems to not let me export it either.
Is it possible to replicate this in a definition?

A:

You can try to use namespaces for this.
Something like:
declare function workerFarm(){}

declare namespace workerFarm
{
    export function end( workers: any ): void;
}

export = workerFarm;

Look at this example in documentation:
http://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-function-d-ts.html

