19 lines
760 B
Plaintext
19 lines
760 B
Plaintext
==== tests/cases/compiler/callOnInstance.ts (4 errors) ====
|
|
declare function D(): string;
|
|
|
|
declare class D { constructor (value: number); } // Duplicate identifier
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'D'.
|
|
|
|
var s1: string = D(); // OK
|
|
|
|
var s2: string = (new D(1))();
|
|
~~~~~~~~
|
|
!!! 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.
|
|
|
|
declare class C { constructor(value: number); }
|
|
(new C(1))(); // Error for calling an instance
|
|
~~~~~~~~~~~~
|
|
!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. |