narrow Message some

This commit is contained in:
Chris Wanstrath 2025-10-03 06:38:30 -07:00
parent 6fcffc65f9
commit 00603452bf
2 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import type { Message } from "../shared/types"
import type { GameStartMessage } from "../shared/types"
import { GameContext, type InputState } from "../shared/game"
import { focusInput } from "./focus"
import { $$ } from "./dom"
@ -29,7 +29,7 @@ let pressed: InputState = {
justReleased: new Set(),
}
export async function handleGameStart(msg: Message) {
export async function handleGameStart(msg: GameStartMessage) {
const msgId = msg.id as string
const name = msg.data as string

View File

@ -8,6 +8,7 @@ export type Message = {
| SaveFileMessage
| SessionStartMessage
| SessionUpdateMessage
| GameStartMessage
export type MessageType = "error" | "input" | "output" | "commands" | "save-file"
| "game:start"
@ -53,3 +54,8 @@ export type SessionUpdateMessage = {
type: "session:update"
data: Record<string, string>
}
export type GameStartMessage = {
id: string
data: string
}