Skip to content

no-misused-new

Reports new and constructor declarations that do not describe a constructor: a class method signature new(): C; without a body that returns the class itself, an interface signature new (): I that returns the interface itself, and an interface member named constructor(). A class method named new with a body is not reported.

An interface cannot be constructed, so new (): I inside interface I describes a constructor that does not exist, and an interface member constructor() is only a method with that name, not a constructor. The code reads as a constructor but is not one.

To fix, declare the constructor in the class (constructor()), or put the new signature on a separate interface that types the constructor.

Reported
...
function local(require: (id: string) => void) { require("d"); }
...
class K { new(): K; new(): number; new() {} }
interface I { new (): I; new (): number; constructor(): void }
function f(): void;
function g(): void {}
...
js:
lint:
rules:
no-misused-new: error # off, warn, error (default)

Enabled by the presets: js/typescript-eslint-recommended, js/biome-recommended, js/oxlint.

Suppress one line with sudsy-disable-next-line no-misused-new in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
typescript-eslint no-misused-new full