refactor(miniprogram): 消灭全部 any 类型 — 32处 → 0 (E3-1)
- catch (err: any) → catch (err: unknown) + instanceof Error 类型缩窄(6 文件 13 处) - BLE 回调类型提取 BLEScanResult/BLEConnectionChangeResult/BLECharacteristicChangeResult/BLEServiceItem - BLEManager 7 处 any 注解替换为具体接口类型 - request.ts method as any → method as ValidMethod 字面量联合类型 - appointment ScheduleItem 接口定义替代 any[] - Taro.requestSubscribeMessage 使用类型断言替代 as any - globalThis.__hms 使用 Record<string, unknown> - TrendChart Canvas/useRef 保留 eslint-disable(微信 API 限制) - 0 TS 错误,119 测试通过
This commit is contained in:
@@ -22,12 +22,12 @@ function App({ children }: PropsWithChildren<Record<string, unknown>>) {
|
||||
// 暴露全局 bridge 供 MCP/自动化测试调用(仅 dev 模式)
|
||||
useEffect(() => {
|
||||
if (process.env.NODE_ENV === 'production') return;
|
||||
(globalThis as any).__hms = {
|
||||
(globalThis as Record<string, unknown>).__hms = {
|
||||
restoreAuth: () => { restoreAuth(); return useAuthStore.getState(); },
|
||||
restoreUI,
|
||||
getAuthState: () => useAuthStore.getState(),
|
||||
};
|
||||
return () => { delete (globalThis as any).__hms; };
|
||||
return () => { delete (globalThis as Record<string, unknown>).__hms; };
|
||||
}, []);
|
||||
|
||||
// Analytics 定时器:仅在页面可见时运行,后台时暂停以节省资源
|
||||
|
||||
Reference in New Issue
Block a user