-1

How to fix this

Not all code paths return a value

Have a look at the code

file path: src/app/app.component.ts

handleClick(itemNumber: number) {
    if (this.winMessage) {
      return this.toastr.success(this.winMessage);
    }

    if (this.itemArray[itemNumber] === 'empty') {
      this.itemArray[itemNumber] = this.isCross ? 'cross' : 'circle';

      this.isCross = !this.isCross;
    } else {
      return this.toastr.info('Already filled');
    }

    this.checkIsWinner();
  }

1 Answers1

2

This is most likely a linter warning based on preferences since the return type constraint of your method appears to implicitly be: “void | object” and not necessarily a TSC/compiler exception.

Start by checking your linters configuration ex: ESLint -> eslint.json/eslint.rc to verify the value of your “noImplicitReturns” attribute.

There are possibly other similar linter configurations depending on which plug-ins or rules you have employed which can produce similar warnings but the above is the most likely and usual culprit for this symptom.

iHazCode
  • 622
  • 4
  • 15