JoshuaKGoldberg / JoshuaKGoldberg/TypeStat

🐛 Bug: Using missingProperties with private class properties broken

Open
#2,183 2 comments 0 reactions 0 assignees View on GitHub
status: accepting prs type: bug
Dominant language
TypeScript
Stars
2.3k
Forks
47
Avg merge
15h 55m
Merged PRs (30d)
21

Description

### Bug Report Checklist

- [x] I have tried restarting my IDE and the issue persists.
- [x] I have pulled the latest `main` branch of the repository.
- [x] I have [searched for related issues](https://github.com/JoshuaKGoldberg/TypeStat/issues?q=is%3Aissue) and found none that matched my issue.

### Expected

```ts
class WaveTracker {
#previouslySeen = new Set();

#repeatedCount = 0;

addAndCheck() {
this.#repeatedCount = 0;
}
}
```

or

```ts
class WaveTracker {
#previouslySeen = new Set();

#repeatedCount: number = 0;

addAndCheck() {
this.#repeatedCount = 0;
}
}
```

### Actual

```ts
class WaveTracker {
#previouslySeen = new Set();

#repeatedCount = 0;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;

addAndCheck() {
this.#repeatedCount = 0;
}
}
```

### Additional Info

This can be reproduced by adding below code to `missingPropertyAccess` test.

```ts
class WaveTracker {
#previouslySeen = new Set();

#repeatedCount = 0;

addAndCheck() {
this.#repeatedCount = 0;
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.