1
0
mirror of https://github.com/thib8956/tic-tac-toe-ws.git synced 2024-11-17 09:26:33 +00:00
tic-tac-toe-ws/common.ts

28 lines
468 B
TypeScript

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