Skip to content

Commit

Permalink
Fix TS compiler error
Browse files Browse the repository at this point in the history
Need a cast to satisfy the type
  • Loading branch information
imericxu committed Jul 11, 2024
1 parent d4dba25 commit fe923d6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib/MazeController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ export class MazeController {
await this.stopMazeAnimation();
const algType: Exclude<GenerationAlgorithm, "random"> =
settings.generationAlgorithm === "random"
? randomFromArray(GENERATION_ALGORITHMS.filter((x) => x !== "random"))
? (randomFromArray(
GENERATION_ALGORITHMS.filter((x) => x !== "random"),
) as Exclude<GenerationAlgorithm, "random">)
: settings.generationAlgorithm;
const alg: MazeGenerator = match(algType)
.with("backtracker", () => new Backtracker({ rows, cols }))
Expand Down Expand Up @@ -165,7 +167,9 @@ export class MazeController {
this.drawer.startEnd = [start, end];
const algType: Exclude<SolveAlgorithm, "random"> =
settings.solveAlgorithm === "random"
? randomFromArray(SOLVE_ALGORITHMS.filter((x) => x !== "random"))
? (randomFromArray(
SOLVE_ALGORITHMS.filter((x) => x !== "random"),
) as Exclude<SolveAlgorithm, "random">)
: settings.solveAlgorithm;
const alg: MazeSolver = match(algType)
.with("bfs", () => new BFS(this.maze!, start, end))
Expand Down

0 comments on commit fe923d6

Please sign in to comment.