Closed lucasfeliciano closed 2 months ago
As discussed via Discord, I'd prefer for TournamentValues
to reflect the actual values of the Tournament
class. Since we have SettableTournamentValues
, we can just create LoadableTournamentValues
as an interface (in the interface folder, adding it to the interface exports, and using it as the type for the Manager loading method).
interface LoadableTournamentValues extends Omit<SettableTournamentValues, 'matches' | 'players'> {
matches: Array<MatchValues>,
players: Array<PlayerValues>
}
@slashinfty should be good now. I had to define the id type in the interface too. Since we are reloading a tournament, it needs an id. I've squashed the commits
Update players and matches types on TournamentValues
The issue
If we try to reload a tournament based on the json we get some TypeScript errors on the
players
andmatches
attributes.This is due that
players
andmatches
attributes onTournamentValues
currently expects an instance ofPlayer
andMatch
. Which include the methods.I believe that is not the intended behaviour since it should expect a serialized json in order to create the instances.
How to reproduce
Solution
I've updated the types on
TournamentValues
to useMatchValues
andPlayerValues
respectively. And onTournament
interface to useMatch
andPlayer
types.Attention
I tried to update the docs, but if I build from my local machine it will reference commits from my forked repository instead of the base repository.
If this solution make sense and you merge it, could you please update the docs for me?