test-migrate-shoehorn

Migrate test files from as type assertions to shoehorn's fromPartial and fromAny.

Updated Mar 23, 2026
One-click install
npx skills add https://github.com/mia-cx/.agents --skill test-migrate-shoehorn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-migrate-shoehorn
Source: https://github.com/mia-cx/.agents/tree/main/skills/test-migrate-shoehorn
Command: npx skills add https://github.com/mia-cx/.agents --skill test-migrate-shoehorn

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Migrate test files from as type assertions to shoehorn to reduce boilerplate and increase type-safety in tests.

Core Features & Use Cases

  • Partial data guarantees: use fromPartial to supply only the necessary fields in tests.
  • Safe error testing: use fromAny to simulate invalid or edge-case inputs without sacrificing type checks.
  • Repeatable workflow: provides a structured migration process with example patterns and imports.

Quick Start

Run the migration workflow to replace as Type assertions with fromPartial and fromAny in your test suite.

Frequently Asked Questions about test-migrate-shoehorn

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

FAQPage Schema
How do I migrate TypeScript tests from `as` type assertions to shoehorn?

To migrate TypeScript tests from `as` type assertions to shoehorn, you replace unsafe casts with `fromPartial` to supply only necessary fields and `fromAny` to simulate edge-case inputs, increasing type-safety and reducing boilerplate.

What is the `fromPartial` function in shoehorn used for in testing?

The `fromPartial` function in shoehorn is used in testing to supply only the necessary subset of properties for large objects, creating realistic and type-safe test inputs without requiring the entire object structure.

Do I need the `@total-typescript/shoehorn` library to migrate my test files?

Yes, you need the `@total-typescript/shoehorn` library installed to migrate your test files, as the workflow relies on its `fromPartial` and `fromAny` functions to replace `as` Type assertions and ensure type-safe test inputs.

What is the best way to safely test invalid inputs in TypeScript without losing type checks?

The best way to safely test invalid inputs in TypeScript without losing type checks is using shoehorn's `fromAny` function, which simulates edge-case or invalid data while maintaining type-safety during test migrations.

Can I use shoehorn to reduce boilerplate when creating test objects with many required properties?

Yes, you can use shoehorn to reduce boilerplate when creating test objects with many required properties by using `fromPartial`, which allows you to provide only the subset of properties needed for the specific test case.