Skip to main content

Enforce valid definition of new and constructor (no-misused-new)

Warns on apparent attempts to define constructors for interfaces or new for classes.

Rule Details

Examples of code for this rule:

class C {
new(): C;
}

interface I {
new (): I;
constructor(): void;
}

Options

{
"@typescript-eslint/no-misused-new": "error"
}

Compatibility

Attributes

  • โœ… Recommended
  • ๐Ÿ”ง Fixable
  • ๐Ÿ’ญ Requires type information