將 Matt 的 TS 模式套用到現有專案
何時使用: 你的專案充滿了 any 和讓人聳肩的型別,你想要有原則地清理。
步驟
-
掃描Use mattpocock/ts-review. Scan /src and list every
any, every unsafe cast, every type hole. Group by file.✓ 已複製→ 逐項列出的發現,而非摘要 -
依原則修復Fix the top 20, narrowest fix per case. Respect Matt's "prefer inference" rule — don't explicit-annotate what TS can infer.✓ 已複製→ 最小化的 diff,獲得型別安全
-
確認Run
tsc --noEmit. Any regressions?✓ 已複製→ 乾淨編譯,或精確範圍的剩餘問題
結果: 一個可量化地更加型別安全的代碼庫,遵循有原則的方法論。
注意事項
- Skill 套用了 Matt 的觀點,但你的團隊有不同意見(例如 interface vs type) — 加入覆蓋指令:「skip the interface-vs-type conversion, keep existing style」
搭配使用: filesystem