Skip to content

What is the type of “props.moves” in the React client's board? #903

Answered by delucis
jakehsiao asked this question in Q&A
Discussion options

You must be logged in to vote

Here's a small example using Typescript, but yes proper TS documentation is still needed.

We don't have strongly typed moves, although it might be theoretically possible to compute them from a game definition, so for now moves is

type moves = Record<
  string,
  (...args: any[]) => void
>;

If you follow the example linked above though you shouldn't have to type this manually. If you specifically need the moves type you can use BoardProps['moves'].

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by delucis
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@delucis
Comment options

@drmercer
Comment options

@delucis
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #869 on February 02, 2021 09:28.