Skip to content

Commit

Permalink
fix: some type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
TN1ck committed Jun 5, 2024
1 parent 6cf500d commit 36759bf
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/components/pages/Game/GameControls/GameControlNumbers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,15 @@ class SudokuMenuNumbers extends React.Component<PropsFromRedux> {
const occurrences = this.props.sudoku.filter((c) => c.number === n).length;

const conflicting = SudokuGame.conflictingFields(this.props.sudoku);
const activeCell = this.props.sudoku[this.props.activeCell!.y * 9 + this.props.activeCell!.x];
const userNotes = activeCell.notes;
const conflictingCell = conflicting[this.props.activeCell!.y * 9 + this.props.activeCell!.x];
const autoNotes = this.props.showHints ? conflictingCell.possibilities : [];

const activeCell = this.props.activeCell
? this.props.sudoku[this.props.activeCell.y * 9 + this.props.activeCell.x]
: undefined;
const userNotes = activeCell?.notes ?? [];
const conflictingCell = this.props.activeCell
? conflicting[this.props.activeCell.y * 9 + this.props.activeCell.x]
: undefined;
const autoNotes = (this.props.showHints ? conflictingCell?.possibilities : []) ?? [];

const setNumberOrNote = () => {
if (this.props.notesMode) {
Expand All @@ -81,7 +86,7 @@ class SudokuMenuNumbers extends React.Component<PropsFromRedux> {
userNotes.length === 0 &&
autoNotes.includes(n) &&
!userNotes.includes(n) &&
activeCell.number === 0,
activeCell?.number === 0,
})}
onClick={setNumberOrNote}
key={n}
Expand Down

0 comments on commit 36759bf

Please sign in to comment.