Fix/typecheck test #601
Reference in New Issue
Block a user
Delete Branch "fix/typecheck-test"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
1.
tests/appSurface/chat-composer.suite.ts:49-54——installTauriRuntime在多个 suite 重复chat-composer与project-conversation各自定义逐字相同的installTauriRuntime({ core: { invoke: unknown }; event?: { listen: unknown } });project-development/runtime-settings是 core-only 版本;design-agent是收ChatRuntimeHarness的版本。tests/appSurface/harness.ts,各 suite 复用。6efab1074。2.
tests/appSurface/design-agent.suite.ts:25-30—— 5 个 suite 各自定义、签名分歧design-agent的版本总是装event.listen,project-conversation的 event 可选,project-development/runtime-settings只收core.invoke。6efab1074)。5 处本地定义全部删除,installTauriRuntime定义只剩harness.ts一处;design-agent保留一个不含 cast 的薄适配installChatRuntime(harness)。3.
tests/appSurface/home.suite.ts:42-44—— 三种 mock 适配写法home.suite用asTauriInvoke/asTauriListen两个适配器,44 处内联window.__TAURI__ = { core: { invoke: asTauriInvoke(...) } };runtime-settings用installTauriRuntime+ 整体as unknown as Window['__TAURI__'];auth.suite的installTauriBridge(invoke, { withEvents })用as never,并返回{ listeners, emit }事件桥。as never完全绕过类型检查,home 的 44 处也各自在调用点转换,安装点不唯一。review 说的"抽一个 installer 全复用"只对一半——installTauriBridge的返回值是事件桥,asTauriInvoke/asTauriListen是逐调用点适配器而非安装器。harness.installTauriRuntime是全仓唯一 cast 点;事件桥拆成纯工具harness.createTauriEventBridge(只登记/派发,不碰 window、不 cast)再组合。不要给安装器加withEvents之类的模式开关——flag argument +void | Bridge联合返回更脏。179983b82。home.suite44 处改为installTauriRuntime({...})并删除两个适配器;auth.suite删除installTauriBridge的as never,改为createTauriEventBridge()+installTauriRuntime(...)。appSurface 内已无as never/asTauriInvoke/asTauriListen。4.
tests/appSurface/home.suite.ts:50-53——asTauriListen形参返回Promise<unknown>asTauriListen(listen: (event, handler) => Promise<unknown>): TauriListen。TauriListen的真实返回是Promise<() => void>(unlisten);写成Promise<unknown>把 unlisten 契约从形参上抹掉了,还多一次unknown往返。Promise<() => void>。listen(返回Promise<() => void>),tsc 通过。commita83525c96。5.
tests/appSurface/runtime-settings.suite.ts:28-30—— 参数只收 core,却 cast 成完整窗口形状installTauriRuntime(runtime: { core: { invoke: unknown } })后整体 cast。window.__TAURI__.event会 type-check 却 undefined"这半句不准确:Window['__TAURI__']声明的core/event本来都是可选的,读它 TS 会要求可选链;真正成立的是参数类型偏窄。event。{ core?: { invoke?: ... }; event?: { listen?: ... } }。commit6efab1074。6.
tests/appSurface/auth.suite.ts:71—— 注释错别字渲染函数子节点改编进 props。19c6b1dfc。7.
tests/appSurface/runtime-settings.suite.ts:28——invoke: unknown过松core: { invoke: unknown }。undefined都能编译通过并被装成运行时 invoke;安装点本应做类型收敛。(command: string, args?: Record<string, unknown>) => Promise<unknown>,listen 收成(event, handler) => Promise<() => void>;vi.fn与各夹具的具体 mock 均可赋值。commit6efab1074。