Skip to content

Commit

Permalink
refactor: fix TypeScript errors
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jan 29, 2025
1 parent 7404c20 commit ad5e8eb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/components/Lose.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { createRef, type Ref, Text, useScene } from 'phaser-jsx';
import { createRef, Text, useScene } from 'phaser-jsx';
import type { RefObject } from 'react';

interface Props {
onClick: () => void;
ref: (ref: Ref<Phaser.GameObjects.Text>) => void;
ref: (ref: RefObject<Phaser.GameObjects.Text | null>) => void;
}

export function Lose(props: Props) {
Expand Down
5 changes: 3 additions & 2 deletions src/components/Win.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { createRef, type Ref, Text, useScene } from 'phaser-jsx';
import { createRef, Text, useScene } from 'phaser-jsx';
import type { RefObject } from 'react';

import { Audio } from '../constants';

interface Props {
onClick: () => void;
ref: (ref: Ref<Phaser.GameObjects.Text>) => void;
ref: (ref: RefObject<Phaser.GameObjects.Text | null>) => void;
}

export function Win(props: Props) {
Expand Down
7 changes: 4 additions & 3 deletions src/scenes/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Phaser from 'phaser';
import { type Ref, render } from 'phaser-jsx';
import { render } from 'phaser-jsx';
import type { RefObject } from 'react';

import { Lose, Title, Win } from '../components';
import { Audio, Image, Scene } from '../constants';
Expand Down Expand Up @@ -177,7 +178,7 @@ export class Main extends Phaser.Scene {
}

startGame() {
let winnerTextRef: Ref<Phaser.GameObjects.Text>;
let winnerTextRef: RefObject<Phaser.GameObjects.Text | null>;

render(
<Win
Expand All @@ -187,7 +188,7 @@ export class Main extends Phaser.Scene {
this,
);

let gameOverTextRef: Ref<Phaser.GameObjects.Text>;
let gameOverTextRef: RefObject<Phaser.GameObjects.Text | null>;

render(
<Lose
Expand Down

0 comments on commit ad5e8eb

Please sign in to comment.