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

26 lines
444 B
TypeScript
Raw Normal View History

2024-09-09 12:09:00 +00:00
export type MessageKind = "hello" | "update" | "endgame";
export interface Message {
2024-09-25 11:40:22 +00:00
kind: MessageKind,
data: Response | Hello | EndGame,
}
export interface Request {
2024-09-25 11:40:22 +00:00
x: number,
y: number
}
export interface Response {
2024-09-25 11:40:22 +00:00
grid: number[],
last: { x: number, y: number, symbol: "x" | "o" }
}
2024-09-08 10:05:02 +00:00
export interface Hello {
2024-09-25 09:58:56 +00:00
id: number,
2024-09-25 11:40:22 +00:00
symbol: "x" | "o"
2024-09-08 10:05:02 +00:00
}
2024-09-09 12:09:00 +00:00
export interface EndGame {
issue: "win" | "lose" | "draw"
}