migrate-to-shoehorn

Replace unsafe as assertions in TypeScript tests with @total-typescript/shoehorn functions.

1|Updated Apr 22, 2026
One-click install
npx skills add https://github.com/Herxinsasa/Skills-Collector --skill migrate-to-shoehorn-herxinsasa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-to-shoehorn
Source: https://github.com/Herxinsasa/Skills-Collector/tree/main/mattpocock-skills/skills/misc/migrate-to-shoehorn
Command: npx skills add https://github.com/Herxinsasa/Skills-Collector --skill migrate-to-shoehorn-herxinsasa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the problem of using unsafe as type assertions in TypeScript test files, which require manual type specification, double casting for intentionally incorrect test data, and faking all properties of large objects even when only a subset are needed, leading to brittle, hard-to-maintain test code.

Core Features & Use Cases

  • Type-safe partial test data: Replaces as Type assertions with the fromPartial() function to pass only required properties of large objects without faking unused fields.
  • Intentional incorrect type handling: Replaces double as unknown as Type casts with the fromAny() function for test cases requiring intentionally wrong data, while retaining autocomplete support.
  • Use Case: For a test that only needs the body.id property of a Request object with 20+ additional properties, this Skill eliminates the need to manually define all unused properties in test setup.

Quick Start

Use this skill to replace all as type assertions in your TypeScript test files with type-safe @total-typescript/shoehorn functions to reduce boilerplate and improve test maintainability.

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 unsafe as type assertions in TypeScript test files?

Replace unsafe as type assertions in TypeScript test files by using the @total-typescript/shoehorn utility functions to ensure type-safe test data. This eliminates manual type specification and reduces boilerplate while maintaining type checking compliance.

What is the best way to pass partial test data for large TypeScript interfaces?

The best way to pass partial test data for large TypeScript interfaces is using the fromPartial() function. It replaces as Type assertions, allowing you to define only required properties without faking unused fields in test setup.

How do I handle intentionally incorrect type data in TypeScript tests without double casting?

Handle intentionally incorrect type data in TypeScript tests without double casting by using the fromAny() function. It replaces the unsafe as unknown as Type pattern for error case testing while retaining autocomplete support.

Why does faking all properties for large objects make test code hard to maintain?

Faking all properties for large objects makes test code hard to maintain because it requires manual type specification and unnecessary property faking. This creates brittle tests that break when interfaces change, even when only a subset of properties is needed.

Can I use shoehorn functions to reduce boilerplate in test setup for large interfaces?

Yes, you can use shoehorn functions to reduce boilerplate in test setup for large interfaces. The utility replaces unsafe type assertions, eliminating the need to manually define all unused properties when a test only requires a subset of fields.

Does migrate-to-shoehorn work with test suites requiring intentionally wrong data for error cases?

Yes, migrate-to-shoehorn works with test suites requiring intentionally wrong data for error cases. It replaces double as unknown as Type casts with the fromAny() function, retaining autocomplete support while ensuring type-safe incorrect data handling.