Sometimes, when we import a module or destructuring an object, the property name are not available, we have to rename it. But during refactor, the property name is available again, we may want to avoid rename.
- const foo = 1;
const {foo: anotherFoo} = bar;
Since we removed foo
, I want to use foo
instead of anotherFoo
now.
Or
const foo = 1;
+ if (bar) {
const {foo: anotherFoo} = bar; // `foo` is available in the new scope now, and I don't need access to the outer `foo`.
+ }
const {foo: anotherFoo} = bar;
// `foo` is avaiable
import {fromPairs as lodashFromPairs} from 'lodash-es';
// No other variable `fromPairs`
const foo = 1;
const {foo: anotherFoo} = bar;
import {fromPairs as lodashFromPairs} from 'lodash-es';
function fromPairs() {
// Do something different from `lodash.fromPairs`
}
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too