---
title: "@typescript-eslint/no-useless-constructor"
description: "Disallow constructors that do what the default constructor does"
# Generated by src/codegen/lint-rule-docs.ts. Do not edit below this line.
plugin: "typescript"
aliases: ["typescript-eslint/no-useless-constructor","typescript/no-useless-constructor"]
kind: "problem"
category: null
default: "off"
fixable: "suggestion"
typeAware: false
deprecated: false
---

A class without a constructor gets one for free. In a base class it's empty, and in a subclass it passes all arguments to `super()`. Writing that out by hand adds lines that do nothing.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"@typescript-eslint/no-useless-constructor" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad {"count": 2} */}
```ts
class Store {
  constructor() {}
}

class HttpError extends Error {
  constructor(message: string) {
    super(message);
  }
}
```

Not reported:

{/* good */}
```ts
class Store {}

class HttpError extends Error {}

class NotFoundError extends Error {
  constructor(path: string) {
    super(`${path} was not found`);
  }
}
```

An empty constructor is allowed if TypeScript gives it a job. A `private` or `protected` constructor limits who can create the class, a parameter property declares a field, and a decorator on a parameter runs code:

{/* good */}
```ts
class Config {
  private constructor() {}
}

class User {
  constructor(public name: string) {}
}
```

A `public` constructor in a subclass is allowed too, because it can open up a `protected` one:

{/* good */}
```ts
class Shape {
  protected constructor() {}
}

class Circle extends Shape {
  public constructor() {
    super();
  }
}
```
