# @typescript-eslint/no-unnecessary-parameter-property-assignment

> Disallow assigning a constructor parameter property to itself

A constructor parameter with `public`, `private`, `protected` or `readonly` in front of it declares a property and assigns the argument to it. Writing `this.name = name` in the body does the same work a second time.

{/* 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-unnecessary-parameter-property-assignment" = "error"
```

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

## Examples

Reported:

{/* bad */}
```ts
class User {
  constructor(public name: string) {
    this.name = name;
  }
}
```

Not reported:

{/* good */}
```ts
class User {
  constructor(public name: string) {}
}
```

An assignment that stores a different value is fine, and so is a copy made after the parameter was changed:

{/* good */}
```ts
class User {
  constructor(
    public name: string,
    private email: string,
  ) {
    this.name = name.trim();

    email = email.toLowerCase();
    this.email = email;
  }
}
```
