So consider the following snippet
const x = {
name: 'somebody'
};
const { name as somePerson } = x; // Would be awesome to have something like this
So consider the following snippet
const x = {
name: 'somebody'
};
const { name as somePerson } = x; // Would be awesome to have something like this
You could change the target in the Object Property Assignment Pattern [You Don't Know JS: ES6 & Beyond, Chapter 2: Syntax]:
The syntactic pattern here is
source: target
(orvalue: variable-alias
).
{ name: somePerson }
const x = {
name: 'somebody'
};
const { name: somePerson } = x;
console.log(somePerson);