migrate-to-shoehorn

Migrate TypeScript test files from `as` assertions to @total-typescript/shoehorn partial mocks.

1|Updated Jun 2, 2026
One-click install
npx skills add https://github.com/SevWren/Daily-Motivation-Brain-Helper --skill migrate-to-shoehorn-sevwren
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: migrate-to-shoehorn
Source: https://github.com/SevWren/Daily-Motivation-Brain-Helper/tree/main/CLAUDE/skills/misc/migrate-to-shoehorn
Command: npx skills add https://github.com/SevWren/Daily-Motivation-Brain-Helper --skill migrate-to-shoehorn-sevwren

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @total-typescript/shoehorn.

What problem does it solve? TypeScript tests often rely on as type assertions to fake large objects, which bypasses type safety, requires manually specifying target types, and forces awkward double-assertions (as unknown as Type) for intentionally wrong data. ## Core Features & Use Cases - Partial test data: Replace as Type with fromPartial() to pass only the properties a test actually needs while keeping TypeScript satisfied. - Intentionally wrong data: Replace as unknown as Type with fromAny() for error-path testing while retaining autocomplete. - Guided migration workflow: Find offending assertions with grep, install the package, rewrite each pattern, and verify with a type check. - Use Case: A test calls getUser() with a Request type containing 20+ properties, but only body.id matters. Migrate to fromPartial({ body: { id: "123" } }) and delete the fake boilerplate. ## Quick Start Ask the assistant to migrate the as type assertions in your test files to @total-typescript/shoehorn using fromPartial and fromAny.

Frequently Asked Questions about migrate-to-shoehorn

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I replace `as` type assertions in TypeScript tests?▼

Install @total-typescript/shoehorn and replace `as Type` with fromPartial() and `as unknown as Type` with fromAny(). Find candidates with grep for ` as [A-Z]` in .test.ts and .spec.ts files, then run a type check to verify.

What is the difference between fromPartial, fromAny, and fromExact in shoehorn?▼

fromPartial() accepts partial data that still type-checks, fromAny() accepts intentionally wrong data while keeping autocomplete, and fromExact() forces a full object that you can later swap to fromPartial.

Can I use shoehorn in production TypeScript code?▼

No. Shoehorn is intended for test code only, where faking partial fixtures is acceptable. Production code should construct fully typed values rather than bypassing the compiler.

Why are `as` assertions a problem in TypeScript tests?▼

They bypass type safety, require manually specifying the target type, and need double-assertions like `as unknown as Type` for intentionally wrong data. Shoehorn provides type-safe alternatives that keep autocomplete working.

How do I install @total-typescript/shoehorn?▼

Run `npm i @total-typescript/shoehorn` in your project, then import fromPartial, fromAny, or fromExact from @total-typescript/shoehorn in your test files.