fix: 修复 TypeScript 编译错误

- 修复 ThemeWorkbenchSidebar 中的属性名不匹配问题
  - _onViewRunDetail -> onViewRunDetail
  - _activeRunDetailLoading -> activeRunDetailLoading
- 修复 safeInvoke.ts 中的类型断言问题
  - 为所有返回结果添加 as T 类型断言
- 确保所有类型检查通过
This commit is contained in:
coso
2026-03-09 09:55:29 +08:00
parent c0e63b6774
commit bb6ae1259d
2 changed files with 7 additions and 7 deletions
@@ -1599,9 +1599,9 @@ function ThemeWorkbenchSidebarComponent({
contextBudget,
activityLogs,
creationTaskEvents = [],
_onViewRunDetail,
onViewRunDetail,
activeRunDetail,
_activeRunDetailLoading = false,
activeRunDetailLoading = false,
onRequestCollapse,
messages = [],
}: ThemeWorkbenchSidebarProps) {
+5 -5
View File
@@ -280,7 +280,7 @@ export async function safeInvoke<T = any>(
(window as any).__TAURI__?.core?.invoke
) {
try {
const result = await (window as any).__TAURI__.core.invoke(cmd, args);
const result = await (window as any).__TAURI__.core.invoke(cmd, args) as T;
recordInvokeTrace(cmd, args, "tauri-ipc", "success", startedAt);
return result;
} catch (error) {
@@ -293,7 +293,7 @@ export async function safeInvoke<T = any>(
// Legacy check for older Tauri versions
if (typeof window !== "undefined" && (window as any).__TAURI__?.invoke) {
try {
const result = await (window as any).__TAURI__.invoke(cmd, args);
const result = await (window as any).__TAURI__.invoke(cmd, args) as T;
recordInvokeTrace(cmd, args, "tauri-legacy", "success", startedAt);
return result;
} catch (error) {
@@ -306,7 +306,7 @@ export async function safeInvoke<T = any>(
// 2. 浏览器开发模式下,部分原生/非关键命令直接优先走 mock。
if (isDevBridgeAvailable() && shouldPreferMockInBrowser(cmd)) {
try {
const result = await baseInvoke(cmd, args);
const result = await baseInvoke(cmd, args) as T;
recordInvokeTrace(cmd, args, "fallback-invoke", "success", startedAt);
return result;
} catch (error) {
@@ -342,7 +342,7 @@ export async function safeInvoke<T = any>(
);
try {
const result = await baseInvoke(cmd, args);
const result = await baseInvoke(cmd, args) as T;
recordInvokeTrace(
cmd,
args,
@@ -368,7 +368,7 @@ export async function safeInvoke<T = any>(
// 4. Fallback 到 mock(Vite alias 会替换 @tauri-apps 导入)
try {
const result = await baseInvoke(cmd, args);
const result = await baseInvoke(cmd, args) as T;
recordInvokeTrace(cmd, args, "fallback-invoke", "success", startedAt);
return result;
} catch (error) {