Closed janKir closed 4 years ago
Currently if turn.order
is not set, it is set using the default order:
But, if you only set first
, as far as I can tell, there are no guards to prevent the game flow then trying to call next
, which would be undefined, so I think the type is correct (even if in your game, next
will never be called if I’ve understood correctly.)
Perhaps there’s an argument for having the default above set as:
conf.turn.order = {
...TurnOrder.DEFAULT,
...conf.turn.order,
}
to allow users to progressively modify the turn order.
But, if you only set first, as far as I can tell, there are no guards to prevent the game flow then trying to call next, which would be undefined, so I think the type is correct (even if in your game, next will never be called if I’ve understood correctly.)
Ah, indeed, in my case, the phase has only a single turn, so next
will never be called. Hence, the types are correct and just revealed a potential source of error in my project.
Perhaps there’s an argument for having the default above set as
conf.turn.order = { ...TurnOrder.DEFAULT, ...conf.turn.order, }
to allow users to progressively modify the turn order.
Yeah, this sounds like a good idea to me!
Upgrading to version
0.39.5
leads to the following typescript error:I am using a custom turn configuration for a phase where the first player does not follow the normal turn order. The
next
function is not needed in my use case and it worked fine so far without it.Is there a reason why the
next
field should always be set when using a custom turn configuration? (I think the same question applies to thefirst
field). Or can we just make these fields optional?