migrate-to-shoehorn

Installation
SKILL.md

Migrate to Shoehorn

Why shoehorn?

shoehorn 允许你在 tests 中传入 partial data,同时保持 TypeScript 满意。它用 type-safe alternatives 替换 as assertions。

只用于 test code。 永远不要在 production code 中使用 shoehorn。

Tests 中 as 的问题:

  • 会训练人忽略类型安全
  • 必须手动指定 target type
  • 对故意错误的数据需要 double-as(as unknown as Type

Install

npm i @total-typescript/shoehorn
Related skills

More from vinvcn/mattpocock-skills-zh-cn

Installs
103
GitHub Stars
132
First Seen
8 days ago