From 0d047e620bc06b746f1d8de951d9e0958fdccdf0 Mon Sep 17 00:00:00 2001 From: coso Date: Mon, 11 May 2026 12:12:36 +0800 Subject: [PATCH] fix: resolve release build type errors --- src/components/settings-v2/account/profile/index.tsx | 8 ++++---- .../account/user-center-session/index.test.tsx | 4 ++-- .../workspace/document/editor/slashCommandItems.tsx | 3 ++- src/pages/update-notification.test.tsx | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/components/settings-v2/account/profile/index.tsx b/src/components/settings-v2/account/profile/index.tsx index cd269b26e..7ba6d3bfc 100644 --- a/src/components/settings-v2/account/profile/index.tsx +++ b/src/components/settings-v2/account/profile/index.tsx @@ -654,7 +654,7 @@ export function ProfileSettings() { {t("settings.profile.hero.tags", { - count: tagsCountLabel, + count: tags.length, defaultValue: "标签:{{count}}", })} @@ -737,7 +737,7 @@ export function ProfileSettings() { {extraTagCount > 0 && ( {t("settings.profile.avatar.extraTags", { - count: extraTagCountLabel, + count: extraTagCount, defaultValue: "+{{count}} 个标签", })} @@ -792,7 +792,7 @@ export function ProfileSettings() { {t("settings.profile.basic.itemCount", { - count: profileFieldCountLabel, + count: profileFields.length, defaultValue: "{{count}} 项", })} @@ -859,7 +859,7 @@ export function ProfileSettings() { {t("settings.profile.tags.selectedCount", { - count: tagsCountLabel, + count: tags.length, defaultValue: "{{count}} 个已选", })} diff --git a/src/components/settings-v2/account/user-center-session/index.test.tsx b/src/components/settings-v2/account/user-center-session/index.test.tsx index 17855463b..c595ef728 100644 --- a/src/components/settings-v2/account/user-center-session/index.test.tsx +++ b/src/components/settings-v2/account/user-center-session/index.test.tsx @@ -315,7 +315,7 @@ describe("UserCenterSessionSettings", () => { it("应按当前 locale 格式化会话时间与能力数量", () => { mockUseTranslation.mockImplementationOnce((_namespace?: string) => ({ i18n: { language: "en-US" }, - t: (key: string, options?: unknown) => { + t: vi.fn((key: string, options?: unknown) => { if (typeof options === "string") { return options; } @@ -330,7 +330,7 @@ describe("UserCenterSessionSettings", () => { } return key; - }, + }), })); mockUseOemCloudAccess.mockReturnValue( createAccessState({ diff --git a/src/components/workspace/document/editor/slashCommandItems.tsx b/src/components/workspace/document/editor/slashCommandItems.tsx index fec227c9f..731cace0e 100644 --- a/src/components/workspace/document/editor/slashCommandItems.tsx +++ b/src/components/workspace/document/editor/slashCommandItems.tsx @@ -53,7 +53,8 @@ const SLASH_COMMAND_I18N_PREFIX = "workspace.document.editor.slashCommand"; function getWorkspaceTranslator(): WorkspaceTranslator { const instance = i18next.isInitialized ? i18next : initLimeI18n(); - return (key: string) => String(instance.t(key, { ns: "workspace" })); + const t = instance.getFixedT(instance.language, "workspace"); + return (key: string) => String(t(key as never)); } function getWorkspaceText(key: string): string { diff --git a/src/pages/update-notification.test.tsx b/src/pages/update-notification.test.tsx index 519ffc80d..90766ebd4 100644 --- a/src/pages/update-notification.test.tsx +++ b/src/pages/update-notification.test.tsx @@ -143,8 +143,8 @@ describe("UpdateNotificationPage", () => { let resolveDownload: (() => void) | undefined; mockDownloadUpdate.mockImplementationOnce( () => - new Promise((resolve) => { - resolveDownload = resolve; + new Promise((resolve) => { + resolveDownload = () => resolve(undefined); }), ); const container = await renderUpdateNotification(