boardgameio / boardgame.io

State Management and Multiplayer Networking for Turn-Based Games
https://boardgame.io
MIT License
10k stars 704 forks source link

Suggestion: support for typing phases with an enum #1042

Open richardcrng opened 2 years ago

richardcrng commented 2 years ago

I wonder if the phase names could be typed, e.g. via an enum.

This would help with things like:

Changes might be:

(I would be happy to contribute a PR for this if it sounds useful?)

richardcrng commented 2 years ago

(There might be wider questions around typings. I've just started exploring the library - which is lovely! - and have also just had the thought that moves could be typed for similar reasons.)

delucis commented 2 years ago

Don’t see why not. There are various things that make fully typing the framework slightly tricky, but it would be good to improve DX in several areas like this.

I assume you mean moves on the client? There’s a more detailed discussion of that here: https://github.com/boardgameio/boardgame.io/discussions/903#discussioncomment-1656065