JoshuaKGoldberg / JoshuaKGoldberg/TypeStat

findRelevantNodeReferencesAsNodes should recurse through export assignments

Open
#1,038 0 comments 0 reactions 1 assignee Claimed by @JoshuaKGoldberg View on GitHub
area: fixers status: accepting prs type: bug
Dominant language
TypeScript
Stars
2.3k
Forks
47
Avg merge
15h 55m
Merged PRs (30d)
21

Description

### 🐛 Bug Report

- TypeStat version: 0.6.0
- TypeScript version: n/a
- Node version: n/a

#### Actual Behavior

Right now, `findRelevantNodeReferencesAsNodes` directly calls to the TS language service's `findReferences` API. That only finds _direct_ references to a node. If the node is re-exported with an export assignment (`export { MyNode }`), then only the reference in the export assignment will be looked at.

#### Expected Behavior

Fixers that try to collect all types used for some node are hamstrung by this. You'd expect them to also see uses of the exported node.

#### Reproduction

The `fixReactPropsMissing` fixer added in #1037 doesn't find the `` in this pair of files:

```ts
// MyComponent.ts
const MyComponent = ({ prop }) =>

{prop}
;
export { MyComponent };
```

```ts
// index.tsx
import { MyComponent } from "./MyComponent";

export const render = () => ;
```

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.