migrate-to-shoehorn

Migrate TypeScript test assertions from 'as' to Shoehorn's 'fromPartial', 'fromAny', and 'fromExact' functions.

1|Updated Jun 22, 2026
One-click install
npx skills add https://github.com/jchildree/The-QUESTION --skill migrate-to-shoehorn-jchildree
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-to-shoehorn
Source: https://github.com/jchildree/The-QUESTION/tree/main/.agents/skills/migrate-to-shoehorn
Command: npx skills add https://github.com/jchildree/The-QUESTION --skill migrate-to-shoehorn-jchildree

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @total-typescript/shoehorn, and includes scripts (resource) components.

What problem does it solve?

The Skill addresses the limitations of 'as' assertions in TypeScript tests by providing a type-safe migration to Shoehorn, improving test reliability and readability.

Core Features & Use Cases

  • Type-Safe Migrations: Converts 'as' assertions to Shoehorn's type-safe alternatives for partial data passing and wrong data handling.
  • Test Code Optimization: Facilitates writing cleaner and more maintainable test code.
  • Use Case: When transitioning your TypeScript test suite to use Shoehorn for better type safety and to reduce the complexity of handling partial data in tests.

Quick Start

Run the command '/migrate-to-shoehorn' to begin the migration process for your test files.

Frequently Asked Questions about migrate-to-shoehorn

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

FAQPage Schema
How do I migrate TypeScript test assertions from 'as' to type-safe alternatives?

Migrating 'as' assertions involves converting them to Shoehorn's 'fromPartial', 'fromAny', and 'fromExact' functions, which provide type-safe partial data handling and intentional wrong data injection for TypeScript test suites.

What is the best way to handle partial data in TypeScript tests without using 'as'?

Using Shoehorn's 'fromPartial' function is a type-safe way to handle partial data in TypeScript tests, replacing 'as' assertions to improve test reliability and maintainability while reducing complexity.

Why should I replace 'as' assertions in my TypeScript test suite?

You should replace 'as' assertions because they lack type safety and can hide errors. Migrating to Shoehorn's functions improves test reliability and readability by enforcing type constraints on partial data and intentional wrong data.

Do I need to install @total-typescript/shoehorn before migrating my test code?

Yes, you need the @total-typescript/shoehorn dependency installed in your project before migrating test assertions, as the migration process converts existing 'as' casts directly into Shoehorn's 'fromPartial', 'fromAny', and 'fromExact' functions.

Can I use Shoehorn to inject intentional wrong data for TypeScript test assertions?

Yes, you can use Shoehorn's 'fromAny' and 'fromExact' functions to intentionally inject wrong data into TypeScript test assertions, providing a type-safe alternative to 'as' for testing error handling and edge cases.