Reputation: 1831
I am reviewing an app build in Vuejs (I am not a vue developer), so be patient with me.
I found this line of code:
const {property, $rxFirebase: {actions: {properties}}} = this
I guess this works as in other languages. "This" is assigning values to the object in the left.
I am trying to read also {sources: {properties}}, so I have added the code like this:
const {property, $rxFirebase: {actions: {properties}, sources: {properties}}} = this
But when I build it, I get an error:
Module build failed: Duplicate declaration "properties"
Any ideas?
Upvotes: 0
Views: 330
Reputation: 6034
This is not just assignment its destructuring assignment. This line:
const {property, $rxFirebase: {actions: {properties}}} = this
is equivalent to
const property = this.property, properties = this.$rxFirebase.actions.properties;
So you can not add another properties
variable because it is already declared. You should add different name for second properties
declaration, like this:
const {property, $rxFirebase: {actions: {properties}, sources: {properties: myProperties }}} = this; // where myProperties some name for variable
console.log(myProperties === this.$rxFirebase.sources.properties); // true
Upvotes: 1