Migrate to Shoehorn
Test code only. Never prod.
@total-typescript/shoehorn replaces test as casts with type-safe helpers for partial data.
Install
bun add -d @total-typescript/shoehorn
Patterns
as Type with partial object -> fromPartial():
import { fromPartial } from "@total-typescript/shoehorn";
getUser(fromPartial({ body: { id: "123" } }));
Intentionally invalid data -> fromPartial() plus targeted override helper from package docs. Avoid as unknown as.
Workflow
- Limit to tests:
*.test.*,*.spec.*, fixtures. - Find casts:
rg " as |as unknown as". - Replace one cluster at a time.
- Run related tests + type check.
- Keep production files untouched.