migrate-to-shoehorn

Migrate test code from `as` assertions to @total-typescript/shoehorn helpers.

4|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/Bailipa/EZTor_FULLBLOOD --skill migrate-to-shoehorn-bailipa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-to-shoehorn
Source: https://github.com/Bailipa/EZTor_FULLBLOOD/tree/main/.opencode/skills/mattpocock-misc/migrate-to-shoehorn
Command: npx skills add https://github.com/Bailipa/EZTor_FULLBLOOD --skill migrate-to-shoehorn-bailipa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.

Core Features & Use Cases

  • Replace as Type with fromPartial(), fromAny(), and fromExact() to simplify tests while preserving type safety.
  • Adopt partial data patterns for large objects in tests without wiring full fixtures.
  • Use in scenarios where tests must simulate partial inputs or intentionally wrong data to test resilience.

Quick Start

Install @total-typescript/shoehorn and refactor tests to replace as assertions with fromPartial or 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 unknown as Type' assertions in TypeScript tests?

Replace 'as unknown as Type' assertions by migrating test code to shoehorn-based helpers like fromPartial, fromAny, and fromExact, which simplify tests and preserve type safety. This requires adding proper shoehorn imports to your test files.

What is the best way to create partial mock data for large objects in TypeScript unit tests?

The best way to create partial mock data for large objects is using shoehorn's fromPartial helper. It allows tests to simulate partial inputs without wiring full fixtures, minimizing setup effort while maintaining strict type safety.

How does shoehorn improve type safety when refactoring test fixtures?

Shoehorn improves type safety by replacing unsafe 'as' type assertions with dedicated helpers like fromExact and fromPartial. This ensures test fixtures covering large objects remain type-safe while intentionally allowing partial or wrong data for resilience testing.

When should I use fromPartial versus fromExact in my test refactoring?

Use fromPartial when tests only require a subset of fields for large objects, minimizing fixture setup. Use fromExact when tests need to simulate intentionally wrong data or validate exact object shapes, ensuring appropriate type safety boundaries.

Do I need to manually add imports when migrating tests to shoehorn helpers?

Yes, you need to add proper imports for shoehorn exports like fromPartial, fromAny, and fromExact in your test files. The migration process requires installing @total-typescript/shoehorn and updating import statements to use these safer helpers.

Can I use shoehorn to test intentionally wrong data inputs in TypeScript?

Yes, you can use shoehorn helpers like fromAny to simulate intentionally wrong data inputs and test application resilience. This approach replaces unsafe 'as' casts while allowing tests to verify behavior against invalid or partial data scenarios.