Declare a constructor inside an interface
, and you will get a simple method with the name "constructor". The same thing will happen if
you create a new
method inside the interface
: you'll get a simple method named "new".
Instead, the intent was probably to specify that the type did not originate from a TypeScript file. In such cases, just use the declare
class
syntax.
interface TypeDeclaredElsewhere { someMethod(): number; new(b: boolean): TypeDeclaredElsewhere; // Noncompliant constructor(b: boolean): void; // Noncompliant }
declare class TypeDeclaredElsewhere { someMethod(): number; constructor(b: boolean); }