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:
iven
2026-05-22 08:30:01 +08:00
parent bdc2d07c1c
commit c9fe654d44
14 changed files with 99 additions and 50 deletions

View File

@@ -86,8 +86,8 @@ export default function Login() {
setNeedBind(true);
Taro.showToast({ title: '请授权手机号完成绑定', icon: 'none' });
}
} catch (err: any) {
const msg = err?.message || '登录失败,请重试';
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : '登录失败,请重试';
Taro.showToast({ title: msg.substring(0, 20), icon: 'none', duration: 3000 });
}
};
@@ -104,8 +104,8 @@ export default function Login() {
if (success) {
navigateAfterLogin();
}
} catch (err: any) {
Taro.showToast({ title: err?.message || '登录失败', icon: 'none' });
} catch (err: unknown) {
Taro.showToast({ title: err instanceof Error ? err.message : '登录失败', icon: 'none' });
}
};
@@ -120,10 +120,10 @@ export default function Login() {
if (success) {
navigateAfterLogin();
}
} catch (err: any) {
} catch (err: unknown) {
Taro.showModal({
title: '绑定手机号失败',
content: err?.message || '绑定失败',
content: err instanceof Error ? err.message : '绑定失败',
confirmText: '重新登录',
cancelText: '取消',
success: (res) => { if (res.confirm) setNeedBind(false); },