Skip to content

Commit e15aa42

Browse files
committed
Doc comments
1 parent 997d0e9 commit e15aa42

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

common/game/roles.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,23 @@ export const TEAMS = {
1111
evil: ["minion", "morgana", "mordred", "assassin", "oberon"],
1212
} as const;
1313

14+
/**
15+
* Describes the identifier of a role given a certain alignment
16+
*/
1417
export type RoleIdOfTeam<T extends Alignment> = (typeof TEAMS)[T][number];
18+
1519
/**
1620
* Describes the identifier of a certain role
1721
*/
1822
export type RoleId = (typeof TEAMS)[keyof typeof TEAMS][number];
19-
export type AlignmentOf<T extends RoleId> =
20-
T extends RoleIdOfTeam<"good">
23+
24+
/**
25+
* Describes the alignment of a role given its identifier
26+
*/
27+
export type AlignmentOf<TRole extends RoleId> =
28+
TRole extends RoleIdOfTeam<"good">
2129
? "good"
22-
: T extends RoleIdOfTeam<"evil">
30+
: TRole extends RoleIdOfTeam<"evil">
2331
? "evil"
2432
: Alignment;
2533

0 commit comments

Comments
 (0)