Hello developers I´m subscribing to a service , and on its next() if everytinh is fine , i do expect to do several things, but I´m receiving this lint error:
Unexpected use of comma operator
the subscription would be kind of:
someMethod(){
someService.MySergvice().subscribe(
()=>{ return (action1,action2,action3)},
.....
)
}
then i receive this error:Unexpected use of comma operator
By the way i did try with this structure:
someService.MySergvice().subscribe(
()=> (action1,action2,action3),
.....
) )
}
And kept the same How can i improve this situation?
CodePudding user response:
The comma operator isn't commonly used like this. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_Operator for more details. In this situation, it's completely useless and doesn't make sense.
This is stuff you should be looking for in documentation first.
This may not be doing what you think. It's always returning action3
. If you wanted to return an array, use square brackets instead.
someService.MySergvice().subscribe(
()=> [action1, action2, action3],
.....
) )
}