diff --git a/packages/workerd/src/plugin.ts b/packages/workerd/src/plugin.ts index 05b7a026..f1df74c4 100644 --- a/packages/workerd/src/plugin.ts +++ b/packages/workerd/src/plugin.ts @@ -11,6 +11,7 @@ import { import { DevEnvironment, type HotChannel, + type HotPayload, type Plugin, type ResolvedConfig, } from "vite"; @@ -108,7 +109,7 @@ export async function createWorkerdDevEnvironment( } }, __viteRunnerSend: async (request) => { - const payload = await request.json(); + const payload = (await request.json()) as HotPayload; hotListener.dispatch(payload); return MiniflareResponse.json(null); }, @@ -206,7 +207,7 @@ export async function createWorkerdDevEnvironment( // wrapper to simplify listener management function createHotListenerManager(): Pick & { - dispatch: (payload: any) => void; + dispatch: (payload: HotPayload) => void; } { const listerMap: Record> = {}; const getListerMap = (e: string) => (listerMap[e] ??= new Set());