dsherret / dsherret/ts-morph

fixUnusedIdentifiers removes unused function parameter in ES6 syntax

Open
#1,360 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
6.2k
Forks
238
Avg merge
2m
Merged PRs (30d)
1

Description

**Description**

Version: ^12.0.0

When I call fixUnusedIdentifiers(), part of the function argument is removed which in ES6 syntax.

**To Reproduce**

```ts
// before
testUnUsedObject={
beforeFetch1(a, b) {
return b
},
beforeFetch2: (a, b) => {
return b
},
}
// after call fixUnusedIdentifiers()
testUnUsedObject={
beforeFetch1(b) {
return b
},
beforeFetch2: (a, b) => {
return b
},
}
```

**Expected behavior**
beforeFetch1 and beforeFetch2 behave the same

Contributor guide

Open the contributing guide

Research direction

Start by locating fixUnusedIdentifiers and reproduce the issue with the beforeFetch1 method and beforeFetch2 arrow-function examples from the report. Compare how unused parameters are handled for each ES6 form; done means both forms preserve equivalent behavior after the fix, with the provided reproduction covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.