migrate-to-shoehorn

Migrate TypeScript tests from as assertions to shoehorn helpers.

356|59|Updated Apr 29, 2026
One-click install
npx skills add https://github.com/amazingloft999-droid/mattpocock-skills --skill migrate-to-shoehorn-amazingloft999-droid
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-to-shoehorn
Source: https://github.com/amazingloft999-droid/mattpocock-skills/tree/main/skills/misc/migrate-to-shoehorn
Command: npx skills add https://github.com/amazingloft999-droid/mattpocock-skills --skill migrate-to-shoehorn-amazingloft999-droid

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Migrate test files from as type assertions to shoehorn. Use when you mention shoehorn, want to replace as in tests, or need partial test data.

Core Features & Use Cases

  • Convert common TS test patterns that use as Type assertions to fromPartial/fromAny wrappers from shoehorn.
  • Improve test readability and type-safety by using shoehorn helpers in unit tests.
  • Provide data mocking for tests without creating large full objects by using fromPartial and fromAny.

Quick Start

Run the migration by replacing as assertions in your tests with fromPartial/fromAny and adding the appropriate imports.

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 tests from as type assertions to safer helpers?

You can migrate TypeScript tests by replacing `as` or `as unknown as` type assertions with `fromPartial` and `fromAny` wrappers from the @total-typescript/shoehorn library to improve type safety and readability.

What is the best way to mock partial test data in TypeScript without building full objects?

Using the shoehorn library's `fromPartial` helper is the best way to mock partial test data in TypeScript, allowing you to construct only the necessary object properties without defining full type structures.

Does migrate-to-shoehorn work with `as unknown as` patterns in TypeScript unit tests?

Yes, migrate-to-shoehorn works with `as unknown as` patterns in TypeScript unit tests by converting these assertions to `fromPartial` or `fromAny` wrappers and automatically adding the necessary shoehorn imports.

How to replace `as` assertions with shoehorn imports in my test files?

To replace `as` assertions with shoehorn, run the migration to substitute `fromPartial` or `fromAny` for your existing type assertions and ensure the appropriate @total-typescript/shoehorn imports are added to your test files.

Why should I replace `as` type assertions with shoehorn in TypeScript tests?

You should replace `as` type assertions with shoehorn in TypeScript tests to improve type safety and readability while providing data mocking without the need to construct large full objects manually.

When should I avoid using shoehorn helpers for test data migration?

You should avoid using shoehorn helpers for test data migration if your unit tests do not use TypeScript, or if your tests require constructing complete objects rather than partial data using `fromPartial` or `fromAny`.