TypeScript 0.9.5 -... args: is any [] dead in the water? (Looking at Qdts)

I hope one of TypeScript will be able to file here. I am one of the Definitely Typed contributors, and I worked on fixing broken Qdts related tests .

The following test in q-tests.ts worked before TS 0.9.5:

var eventualAdd = Q.promised((a: number, b: number) => a + b);

The method definition is promisedas follows:

export function promised<T>(callback: (...args: any[]) => T): (...args: any[]) => Promise<T>;

But now we are at 0.9.5, this test does not compile and does not run with this error:

error TS2082: Supplied parameters do not match any signature of call target:
Call signatures of types '(a: number, b: number) => number' and '(...args: any[]) => {}' are incompatible:
Call signature expects 0 or fewer parameters.
error TS2087: Could not select overload for 'call' expression.

I tried to tweak the test to get a little more information, for example by specifying typing like this:

var eventualAdd = Q.promised<number>((a: number, b: number) => a + b);

But I don't get much more information - it fails just like this:

error TS2082: Supplied parameters do not match any signature of call target:
Call signatures of types '(a: number, b: number) => number' and '(...args: any[]) => number' are incompatible:
Call signature expects 0 or fewer parameters.
error TS2087: Could not select overload for 'call' expression.

- ? , . , . , , TS 0.9.5 - {} ? , ...args: any[] ? , !

+4
1

: https://github.com/borisyankov/DefinitelyTyped/pull/1467

:

" . ...args: any[] , 0 , , . (a: number, b: number) => number , 2 . , (a?: number, b?: number) => number, 0, 1 2 ( , ).

, . , TypeScript , , . , .

+2

All Articles