Skip to content

Instantly share code, notes, and snippets.

@morintd
Created March 10, 2024 16:05
Show Gist options
  • Save morintd/74deed0f78ccb88678e9b576ebeaa0ec to your computer and use it in GitHub Desktop.
Save morintd/74deed0f78ccb88678e9b576ebeaa0ec to your computer and use it in GitHub Desktop.
export namespace GameDomainModel {
export enum Square {
X = "X",
O = "O",
Empty = "",
}
export type Squares = [
Square,
Square,
Square,
Square,
Square,
Square,
Square,
Square,
Square
];
export type Board = {
squares: Squares;
};
export type Player = Square.X | Square.O;
export type Winner = Player | null | "draw";
export type GameState = {
winner: Winner;
history: Squares[];
xIsNext: boolean;
step: number;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment