Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

Possibly incorrect operand: “index” or “-1” #36

Open
maksimr opened this issue Jun 3, 2020 · 2 comments
Open

Possibly incorrect operand: “index” or “-1” #36

maksimr opened this issue Jun 3, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@maksimr
Copy link

maksimr commented Jun 3, 2020

image

      if (index === -1 && $ctrl.pagerConfig && $ctrl.pagerConfig.currentPage !== 1) {
        return $ctrl.onPageChange($ctrl.pagerConfig.currentPage - 1).then(() => {
          const prevIssue = $ctrl.issues[$ctrl.issues.length - 1];

if change -1 to (-1) it will not show the error message. Looks like the problem in - sign

      if (index === (-1) && $ctrl.pagerConfig && $ctrl.pagerConfig.currentPage !== 1) {
        return $ctrl.onPageChange($ctrl.pagerConfig.currentPage - 1).then(() => {
          const prevIssue = $ctrl.issues[$ctrl.issues.length - 1];
          prevIssue && $ctrl.selection.focusIssue(prevIssue);

image

@AnastasiaTuchina AnastasiaTuchina added the bug Something isn't working label Jun 3, 2020
@maksimr
Copy link
Author

maksimr commented Jul 11, 2020

@iamjoeker
Copy link

iamjoeker commented Oct 6, 2020

I've had a similar issue as well. As you can see some the details in the screenshot. The type of event.entity.tier is number. As you mention above, wrapping 0 in parenthesis eliminates the error message.

image

In my case, it looks like the plugin thinks that the LHS could possibly be undefined (even though the source type supports neither undefined nor null. Adding a null coalesce as below also prevents the error from appearing.

if ((event.entity.tier ?? 0) > 0) {

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants