persona-community-5/.pnpm-store/v3/files/df/045cca4934dcff9a55a5ba858a19c2b8134796af940e6b76614041fad322ab7371307b4f884c1d56fd040c960c0151d8cced9abb94a072be19911b82645ad2
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

43 lines
1003 B
Plaintext

---
description: 'Disallow unnecessary assignment of constructor property parameter.'
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
> 🛑 This file is source code, not the primary documentation location! 🛑
>
> See **https://typescript-eslint.io/rules/no-unnecessary-parameter-property-assignment** for documentation.
[TypeScript's parameter properties](https://www.typescriptlang.org/docs/handbook/2/classes.html#parameter-properties) allow creating and initializing a member in one place.
Therefore, in most cases, it is not necessary to assign parameter properties of the same name to members within a constructor.
## Examples
<Tabs>
<TabItem value="❌ Incorrect">
```ts
class Foo {
constructor(public bar: string) {
this.bar = bar;
}
}
```
</TabItem>
<TabItem value="✅ Correct">
```ts
class Foo {
constructor(public bar: string) {}
}
```
</TabItem>
</Tabs>
## When Not To Use It
If you don't use parameter properties, you can ignore this rule.