How can I create a type definition for a function (global scope) named as a reserved keyword such as "module" (qunit, http://api.qunitjs.com/module/)?
Is there a prefix char or something I can use? A char that simply gets removed on compile.
How can I create a type definition for a function (global scope) named as a reserved keyword such as "module" (qunit, http://api.qunitjs.com/module/)?
Is there a prefix char or something I can use? A char that simply gets removed on compile.
I also think there is no way for this. In these cases you can use something like:
QUnit.module('module_name');
I'm working on a qunit.d.ts file on this link. With it you can use the code I put above.
I don't believe there is a way to do this currently - there is nothing like CoffeeScripts back-tick syntax.
One work-around would be to create a function in your JavaScript to alias the module function:
JavaScript
function moduleAlias(name, lifecycle) {
module(name, lifecycle);
}
TypeScript
declare var moduleAlias: { (name: string, lifecycle: any) : void; };
moduleAlias('Test', {});
As per my answer here this works for me:
declare var module: any;
(module).exports = MyClass;