narrow Message some
This commit is contained in:
parent
6fcffc65f9
commit
00603452bf
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user