搜索 K
主题
把测试文件里的 as 断言迁到 @total-typescript/shoehorn:fromPartial() 传部分数据、fromAny() 传故意错的数据。
as 泛滥、大对象只用少数字段、要 as unknown as 造错数据测错误路径。把测试里的 as 断言迁到 shoehornas 有问题、是不是大对象只用几字段、要不要故意错数据。npm i @total-typescript/shoehorn,grep -r " as [A-Z]" --include="*.test.ts" --include="*.spec.ts" 找目标。as Type → fromPartial(),as unknown as Type → fromAny(),补 import。fromPartial() 部分数据仍过类型检查、fromAny() 错数据保留自动补全、fromExact() 先全量后可换 fromPartial。