1
0
mirror of https://github.com/thib8956/tic-tac-toe-ws.git synced 2024-09-29 06:06:37 +00:00
tic-tac-toe-ws/common.mts
2024-09-25 13:40:22 +02:00

26 lines
444 B
TypeScript

export type MessageKind = "hello" | "update" | "endgame";
export interface Message {
kind: MessageKind,
data: Response | Hello | EndGame,
}
export interface Request {
x: number,
y: number
}
export interface Response {
grid: number[],
last: { x: number, y: number, symbol: "x" | "o" }
}
export interface Hello {
id: number,
symbol: "x" | "o"
}
export interface EndGame {
issue: "win" | "lose" | "draw"
}