3

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.

3 Answers 3

3

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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', {});

Comments

0

As per my answer here this works for me:

declare var module: any;
(module).exports = MyClass;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.