microsoft / microsoft/TypeScript
Refactoring to convert destructuring declaration to property accesses
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
From https://github.com/Microsoft/vscode/issues/72502
Feature request
Add a refactoring that converts a destructured local to normal propery access:
const {x, y, z} = someObject;
console.log(x + y * z);
Would be converted to:
const newLocal = someObject;
console.log(newLocal.x + newLocal.y * newLocal.z);
We would want to also trigger a rename on newLocal, similar to how the extract refactorings work
This would be the inverse refactoring of #25946
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the related VS Code issue 72502 and the inverse refactoring in issue 25946. Define the conversion from destructured locals to property accesses, including introducing a local for the source object and triggering a rename on it. Done means the refactoring handles the requested example and has coverage for its transformation and rename behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100