Skip to content

typescript/no-unsafe-declaration-merging Correctness

This rule is turned on by default.

What it does

Disallow unsafe declaration merging.

Why is this bad?

Declaration merging between classes and interfaces is unsafe. The TypeScript compiler doesn't check whether properties are initialized, which can cause lead to TypeScript not detecting code that will cause runtime errors.

Example

ts
interface Foo {}
class Foo {}

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny typescript/no-unsafe-declaration-merging
json
{
  "rules": {
    "typescript/no-unsafe-declaration-merging": "error"
  }
}

References

Released under the MIT License.