2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts (9 errors) ====
|
|
|
|
// it is always illegal to provide type arguments to a non-generic function
|
|
|
|
// all invocations here are illegal
|
|
|
|
|
|
|
|
function f(x: number) { return null; }
|
|
|
|
var r = f<string>(1);
|
|
|
|
~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
var f2 = (x: number) => { return null; }
|
|
|
|
var r2 = f2<string>(1);
|
|
|
|
~~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
var f3: { (x: number): any; }
|
|
|
|
var r3 = f3<string>(1);
|
|
|
|
~~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
class C {
|
|
|
|
f(x: number) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var r4 = (new C()).f<string>(1);
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
interface I {
|
|
|
|
f(x: number): any;
|
|
|
|
}
|
|
|
|
var i: I;
|
|
|
|
var r5 = i.f<string>(1);
|
|
|
|
~~~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
class C2 {
|
|
|
|
f(x: number) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var r6 = (new C2()).f<string>(1);
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
interface I2 {
|
|
|
|
f(x: number);
|
|
|
|
}
|
|
|
|
var i2: I2;
|
|
|
|
var r7 = i2.f<string>(1);
|
|
|
|
~~~~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
var a;
|
|
|
|
var r8 = a<number>();
|
|
|
|
~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2347: Untyped function calls may not accept type arguments.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
var a2: any;
|
|
|
|
var r8 = a2<number>();
|
|
|
|
~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2347: Untyped function calls may not accept type arguments.
|