react-performance
react-performance copied to clipboard
Added the TypeScript support.
Hi Kent!
I managed to convert this workshop from JavaScript to TypeScript. I tested this myself and it's working as intended. 😊
I'm aware that in different workshops, the TypeScript version exists within the "next" branch, but because it doesn't exist, I wanted to let you know in some way that I wanted to apply my changes.
My additional notes:
- globe/index.tsx - I decided to add the
@ts-nocheck
because I couldn't manage to resolve the typings issues. I think that this isn't as important to be typed as other parts of the workshop (but I can be wrong). - In exercises 5 and 6, precisely in the Cell component, I had an issue with accessing the cell number within the state.grid.
const cell = state.grid[row][column]
- this throws error in TypeScript since it could beundefined
. I managed to fix this by creating an array and trying to access it.const cell = Array.from(state.grid[row] ?? [])[column] ?? 0
But for me, it looks like an excessive workaround and I presume that there's a better solution than this.
This is awesome to have! I'll try to give this a look soon. I just got a new job and may not have time soon/ever 😅 but hopefully what you've done here will be useful to others!