feat: preserve explicit round robin pairings

This commit is contained in:
dahyeon committed 2026-07-13 03:50:32 +00:00
1 parent 640e593676
commit c2f89f9cb2
5 files changed
+347 -34

No files matched your search

+11 -13
View File
@@ -1,8 +1,5 @@
import type { TeamId } from "./ids.js";
import type {
FirstToSeriesRule,
FixedGamesSeriesRule,
} from "./series.js";
import type { FirstToSeriesRule, FixedGamesSeriesRule } from "./series.js";
export type CompetitionFormatType =
| "paired-series"
@@ -14,20 +11,21 @@ export interface PairedSeriesCompetitionFormat {
rule: FixedGamesSeriesRule;
}
export type RoundRobinTieBreaker =
| "series-wins"
| "game-diff"
| "head-to-head";
export type RoundRobinTieBreaker = "series-wins" | "game-diff" | "head-to-head";
export interface RoundRobinPairing {
roundNumber: number;
matchNumber: number;
teamAId: TeamId;
teamBId: TeamId;
}
export interface RoundRobinCompetitionFormat {
type: "round-robin";
rule: FixedGamesSeriesRule;
maxRounds?: number;
tieBreakers: [
"series-wins",
"game-diff",
"head-to-head",
];
pairings?: RoundRobinPairing[];
tieBreakers: ["series-wins", "game-diff", "head-to-head"];
}
export interface DoubleEliminationSeriesRules {
@@ -3,6 +3,7 @@ import type {
CompetitionId,
CompletedSeriesProjection,
InProgressSeriesProjection,
RoundRobinCompetitionFormat,
SeriesOutcome,
TeamId,
} from "../src/index.js";
@@ -26,3 +27,23 @@ export type InProgressSeriesCannotExposeOutcome = Expect<
export type LegacyBracketModeIsNotACompetitionFormat = Expect<
Not<IsAssignable<{ type: "bracket" }, CompetitionFormat>>
>;
type ExplicitRoundRobinPairing = NonNullable<
RoundRobinCompetitionFormat["pairings"]
>[number];
export type ExplicitRoundRobinPairingsAreOptional = Expect<
IsAssignable<{}, Pick<RoundRobinCompetitionFormat, "pairings">>
>;
export type ExplicitRoundRobinPairingsAreTeamIdBased = Expect<
IsAssignable<
ExplicitRoundRobinPairing,
{
roundNumber: number;
matchNumber: number;
teamAId: TeamId;
teamBId: TeamId;
}
>
>;