diff --git a/docs/documentation/typescript.md b/docs/documentation/typescript.md index ba029a190..031f5859e 100644 --- a/docs/documentation/typescript.md +++ b/docs/documentation/typescript.md @@ -23,17 +23,20 @@ export const MyGame: Game = { ### React -React components must include boardgame.io-specific properties, so extend your props from `BoardProps`: +React components must include boardgame.io-specific properties, so extend your +props from `BoardProps`. By passing your game state type to `BoardProps`, +you’ll get the correct typing for `G` in your board component. ```typescript // Board.tsx import type { BoardProps } from 'boardgame.io/react'; +import type { MyGameState } from './Game.ts' -interface MyGameProps extends BoardProps { - // Custom properties for your component +interface MyGameProps extends BoardProps { + // Additional custom properties for your component } -export class MyGameBoard extends React.Component { +export function MyGameBoard(props: MyGameProps) { // Your game board } ```