My understanding is destructuring like this will pick properties from the incoming argument object:
const last = "Smith" // unrelated const
const full = function({ first, last }) {
return [first, last].filter(v => v).join(" ")
}
full({last: "Doe"}) // "Doe"
full({}) // ""
And this seems to work the same for imports.
import last from "last"; // unrelated import
export function full({ first, last }) {
return [first, last].filter(v => v).join(" ")
}
full({last: "Doe"}) // "Doe"
full({}) // ""
Why then does this cause a no-shadow
eslint error?
error 'last' is already declared in the upper scope no-shadow
Is there any circumstance where full
could have access to the outer reference? No, right? How might I keep syntax close to this without renaming the unrelated outer last
reference?