Skip to main content

no-misused-new

Enforce valid definition of new and constructor.

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

// .eslintrc.json
{
"rules": {
"@typescript-eslint/no-misused-new": "error"
}
}

This rule is not configurable.

Attributes

  • ✅ Recommended
  • 🔧 Fixable
  • 💭 Requires type information