> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# no-duplicate-type-constituents

[Added in v0.1.4](https://github.com/web-infra-dev/rslint/releases/tag/v0.1.4)
## Configuration

| Preset                              | Configured Value |
| ----------------------------------- | ---------------- |
| ✅ ts.configs.recommendedTypeChecked | `"error"`        |
| ✅ ts.configs.strictTypeChecked      | `"error"`        |


```ts title=rslint.config.ts
import { defineConfig, ts } from '@rslint/core';

export default defineConfig([
  ts.configs.recommended,
  {
    rules: {
      '@typescript-eslint/no-duplicate-type-constituents': 'error',
    },
  },
]);
```

## Rule Details

Disallows duplicate constituents in union or intersection types. Having the same type more than once in a union (`|`) or intersection (`&`) is redundant and can be removed without changing the type. This rule also flags explicit `undefined` on optional parameters, since the `?` modifier already implies `undefined`.

Examples of **incorrect** code for this rule:

```typescript
type Foo = string | string;

type Bar = number & number;

type Baz = 'a' | 'b' | 'a';

function fn(x?: string | undefined) {}
```

Examples of **correct** code for this rule:

```typescript
type Foo = string | number;

type Bar = { a: string } & { b: number };

type Baz = 'a' | 'b' | 'c';

function fn(x?: string) {}
```

## Original Documentation

- [typescript-eslint: no-duplicate-type-constituents](https://typescript-eslint.io/rules/no-duplicate-type-constituents)
- [Source code](https://github.com/typescript-eslint/typescript-eslint/blob/v8.67.0/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts)
