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:
- โ Incorrect
- โ Correct
class C {
new(): C;
}
interface I {
new (): I;
constructor(): void;
}
class C {
constructor() {}
}
interface I {
new (): C;
}
Options
{
"@typescript-eslint/no-misused-new": "error"
}
Related To
- TSLint: no-misused-new
Attributes
- โ Recommended
- ๐ง Fixable
- ๐ญ Requires type information