-
Notifications
You must be signed in to change notification settings - Fork 951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: replace JSX with TSX for type safety #35
base: main
Are you sure you want to change the base?
feat: replace JSX with TSX for type safety #35
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/Landing.tsx
Outdated
} | ||
} | ||
|
||
const handleKeyDown = (event) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const handleKeyDown = (event) => { | |
const handleKeyDown = (event: KeyboardEvent) => { |
src/Landing.tsx
Outdated
|
||
const logo = useRef() | ||
const startButton = useRef() | ||
const homeRef = useRef() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const homeRef = useRef() | |
const homeRef = useRef<null | HTMLDivElement>(null) |
src/Landing.tsx
Outdated
const { gameStarted, actions } = useStore() | ||
|
||
const logo = useRef() | ||
const startButton = useRef() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const startButton = useRef() | |
const startButton = useRef<null | HTMLDivElement>(null) |
src/Landing.tsx
Outdated
export const Landing = () => { | ||
const { gameStarted, actions } = useStore() | ||
|
||
const logo = useRef() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const logo = useRef() | |
const logo = useRef<null | HTMLImageElement>(null) |
@@ -11,7 +11,13 @@ import FakeFlame from '../../ShaderMaterials/FakeFlame/FakeFlame' | |||
import { useStore } from '../../store' | |||
import gsap from 'gsap' | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type MarioProps = {
currentSpeed: number;
steeringAngleWheels: number;
isBoosting: boolean;
shouldLaunch: boolean;
}
isBoosting, | ||
shouldLaunch, | ||
...props | ||
}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}) { | |
}: MarioProps) { |
@@ -21,36 +27,31 @@ export function Mario({ currentSpeed, steeringAngleWheels, isBoosting, shouldLau | |||
const [scale, setScale] = React.useState(1) | |||
const { actions } = useStore() | |||
const [shouldSlow, setShouldSlow] = React.useState(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const [shouldSlow, setShouldSlow] = React.useState(false) | |
const [,, setShouldSlow] = React.useState(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tuple type '[boolean, Dispatch<SetStateAction<boolean>>]' of length '2' has no element at index '2'.ts(2493)
Shouldn't that state be removed?
isBoosting, | ||
shouldLaunch, | ||
...props | ||
}) { | ||
const { nodes, materials } = useGLTF('./models/characters/mariokarttest.glb') | ||
|
||
const frontLeftWheel = useRef() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const frontLeftWheel = useRef() | |
const frontLeftWheel = useRef<Mesh>(null!) | |
const frontRightWheel = useRef<Mesh>(null!) | |
const rearWheels = useRef<Mesh>(null!) | |
const frontWheels = useRef<Mesh>(null!) |
@@ -21,36 +27,31 @@ export function Mario({ currentSpeed, steeringAngleWheels, isBoosting, shouldLau | |||
const [scale, setScale] = React.useState(1) | |||
const { actions } = useStore() | |||
const [shouldSlow, setShouldSlow] = React.useState(false) | |||
const mario = useRef(); | |||
const mario = useRef() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const mario = useRef() | |
const mario = useRef<Group<Object3DEventMap>>(null!); | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi - Good work in adding typescript.
We have a few areas where typescript is complaining. Could you please fix them?
For the file please add props
|
There are lots of areas where TypeScript is complaining. I think I would need some help here. |
Hey. How can I help? |
I believe every file in which there's a TypeScript error, must be fixed. |
Yeah. If you give me permission to fork this repo or raise a PR from the main repo, I can fix those type issues. First, we need to merge your PR. What do you suggest? |
Hmm, I didn't see any issues caused by my code, so I think it's ok to merge. |
I think so too. My only worry is if there is any linters during the build process. Anyway, please let me know once it's merged. I'll raise a new PR with the types fixed. 😀 |
cc: @Lunakepio |
Whats the latest update on this? |
use as a starting point (?)