RequireJS module declarations in TypeScript

Viewed 1054

I've recently updated to TypeScript 0.9.5 which is now throwing up new errors during compilation.

I'm defining an AMD module using RequireJS as outlined HERE.

define('myModule', [
    'angular',
    'config'
    ], function (angular, config) {
        'use strict';

        ...
});

The TypeScript definition file for RequireJS has the following definition for RequireDefine:

/**
* Define a module with a name and dependencies.
* @param name The name of the module.
* @param deps List of dependencies module IDs.
* @param ready Callback function when the dependencies are loaded.
*   callback deps module dependencies
*   callback return module definition
**/
(name: string, deps: string[], ready: (...deps: any[]) => any): void;

However I'm getting the following errors:

error TS2082: Build: Supplied parameters do not match any signature of call target:
error TS2087: Build: Could not select overload for 'call' expression.

The intellisense error states:

Call signatures of types '(angular:any, config:any) => any' and '(...deps: any[]) => any' are incompatible.

Is the definition file incorrect? Where am I going wrong with the callback parameters?

Further Information:

Changing the declaration to the following now compiles.

define('myModule', [
    'angular',
    'config'
    ], function (...args:any[]) {
        'use strict';

        ...
});

However moving to a single parameter object is surely a backwards step? Is this a limitation of the definition file or the TypeScript compiler?

2 Answers
Related