---
title: Avoid unsafe declaration merging
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > Code Security > Static Code Analysis (SAST) > SAST
  Rules > Avoid unsafe declaration merging
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Avoid unsafe declaration merging

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

## Metadata{% #metadata %}

**ID:** `typescript-best-practices/no-unsafe-declaration-merging`

**Language:** TypeScript

**Severity:** Error

**Category:** Error Prone

## Description{% #description %}

Do not merge class and interface declarations. The compiler won't check property initialization, which might lead to runtime errors.

## Non-Compliant Code Examples{% #non-compliant-code-examples %}

```typescript
interface Foo {}
class Foo {}
```

## Compliant Code Examples{% #compliant-code-examples %}

```typescript
interface Foo {}
class Bar implements Foo {}

namespace Baz {}
namespace Baz {}
enum Baz {}

namespace Qux {}
function Qux() {}
```
  Seamless integrations. Try Datadog Code SecurityDatadog Code Security 
{% icon name="icon-external-link" /%}
 