-3

I have the following line

    shareViewMetadata.sharedWith = [sharedWith.find((recipient) => (recipient.id = userId)) as UserView];

That gets the linting error: Arrow function should not return assignment no-return-assign How could I fix it?

  • That code would always return the first element as long as the userId is truthy. Linter caught a bug since you were doing an assignment instead of a comparison. – epascarello Mar 07 '22 at 14:34

1 Answers1

2
(recipient.id = userId)

should be

(recipient.id == userId)
aymcg31
  • 599
  • 3
  • 12