TypeScript/tests/baselines/reference/instantiateNonGenericTypeWithTypeArguments.errors.txt
2014-09-11 16:11:08 -07:00

31 lines
1.1 KiB
Plaintext

==== tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts (6 errors) ====
// it is an error to provide type arguments to a non-generic call
// all of these are errors
class C {
x: string;
}
var c = new C<number>();
~~~~~~~~~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
function Foo(): void { }
var r = new Foo<number>();
~~~~~~~~~~~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
~~~~~~~~~~~~~~~~~
!!! error TS2350: Only a void function can be called with the 'new' keyword.
var f: { (): void };
var r2 = new f<number>();
~~~~~~~~~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
~~~~~~~~~~~~~~~
!!! error TS2350: Only a void function can be called with the 'new' keyword.
var a: any;
// BUG 790977
var r2 = new a<number>();
~~~~~~~~~~~~~~~
!!! error TS2347: Untyped function calls may not accept type arguments.