refactor: improve type safety across codebase #90
Reference in New Issue
Block a user
Delete Branch "refactor/type-safety"
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?
What
TypeScript 类型安全优化,消除 codebase 中的类型断言和 as 强制转换。
Why
减少运行时类型安全隐患,让编译器能捕获更多错误。
Changes
Ref
纯重构,无行为变更。Build 通过。
LGTM ✅ isPlainRecord() type guard 一招解决全局 as Record 问题,干净。亮点:ipc.ts parseParentMessage/parseWorkerMessage 从 raw as X 改为逐字段构造返回对象,彻底消除运行时类型不匹配风险。isSenseInfo/isWorkflowDefinitionShape 等 type guard 也很扎实。
let scheduler!: ReflexScheduler用 definite assignment 替代 null as unknown 是正确做法。