From 9de9f4b419305b65eb0684419164f8ffb2548068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 3 Oct 2026 19:17:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=EF=BC=9A=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E6=B8=B8=E7=8E=A9=E4=B8=8A=E6=8A=A5=E7=9A=84=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - gameDistributionClient.ts:recordGamePlay 标注 Promise<{ recorded?: boolean }>,空 id 分支也返回同形状对象,消除 Promise 与对象 Promise 的联合类型 --- src/services/gameDistributionClient.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/gameDistributionClient.ts b/src/services/gameDistributionClient.ts index 36e902ce3..dfb89898a 100644 --- a/src/services/gameDistributionClient.ts +++ b/src/services/gameDistributionClient.ts @@ -181,9 +181,11 @@ export async function getGame(gameId: string) { /** * 上报一次「开始游戏」。调用方按 fire-and-forget 处理:失败只静默忽略,绝不阻断进入游戏。 */ -export function recordGamePlay(gameId: string) { +export function recordGamePlay( + gameId: string, +): Promise<{ recorded?: boolean }> { const normalizedId = gameId.trim(); - if (!normalizedId) return Promise.resolve(); + if (!normalizedId) return Promise.resolve({ recorded: false }); return requestJson<{ recorded?: boolean }>( `/games/${encodeURIComponent(normalizedId)}/plays`, {