feat: define competition domain contracts
This commit is contained in:
1 parent
f4ba3d524f
commit
05a83db886
13 files changed
+843
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import type {
|
||||
CompetitionFormat,
|
||||
CompetitionId,
|
||||
CompletedSeriesProjection,
|
||||
InProgressSeriesProjection,
|
||||
SeriesOutcome,
|
||||
TeamId,
|
||||
} from "../src/index.js";
|
||||
|
||||
type Expect<T extends true> = T;
|
||||
type IsAssignable<From, To> = [From] extends [To] ? true : false;
|
||||
type Not<T extends boolean> = T extends true ? false : true;
|
||||
|
||||
export type TeamIdCannotBeUsedAsCompetitionId = Expect<
|
||||
Not<IsAssignable<TeamId, CompetitionId>>
|
||||
>;
|
||||
|
||||
export type CompletedSeriesRequiresOutcome = Expect<
|
||||
IsAssignable<CompletedSeriesProjection, { outcome: SeriesOutcome }>
|
||||
>;
|
||||
|
||||
export type InProgressSeriesCannotExposeOutcome = Expect<
|
||||
IsAssignable<InProgressSeriesProjection, { outcome?: never }>
|
||||
>;
|
||||
|
||||
export type LegacyBracketModeIsNotACompetitionFormat = Expect<
|
||||
Not<IsAssignable<{ type: "bracket" }, CompetitionFormat>>
|
||||
>;
|
||||
Reference in new issue
Block a user