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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With