migrate-to-shoehorn

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

Updated May 7, 2026
One-click install
npx skills add https://github.com/hgxszhj/mattpocock_skills --skill migrate-to-shoehorn-hgxszhj
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-to-shoehorn
Source: https://github.com/hgxszhj/mattpocock_skills/tree/main/skills/misc/migrate-to-shoehorn
Command: npx skills add https://github.com/hgxszhj/mattpocock_skills --skill migrate-to-shoehorn-hgxszhj

SYSTEM DOCUMENTATION & REQUIREMENTS

## What problem does it solve? Migrate test files from as type assertions to safe, type-safe replacements using shoehorn. Use when you mention shoehorn, want to replace as in tests, or need partial test data.

## Core Features & Use Cases

  • Replace as Type with fromPartial() to infer a partial object while preserving type safety for the rest of the structure.
  • Replace as unknown as Type with fromAny() to keep autocomplete while testing edge cases.
  • Use fromExact() to enforce a full object during migration, then switch to partials as needed.

### Quick Start Install the migration guide and run it to convert existing tests from as assertions to shoehorn-based helpers.

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` type assertions with type-safe alternatives in TypeScript tests?

To replace `as` type assertions in TypeScript tests, use shoehorn's `fromPartial()` helper to infer partial objects while preserving overall type safety. This migration improves test reliability across files using intentional mismatches.

What is the best way to test edge cases with partial data in TypeScript without losing autocomplete?

The best way to test edge cases with partial data while keeping autocomplete is using shoehorn's `fromAny()` helper. It safely replaces `as unknown as Type` assertions to handle intentional mismatches without sacrificing type inference.

When do I need to enforce a full object structure during a TypeScript test migration?

You need to enforce a full object structure during a TypeScript test migration when validating complete data shapes before transitioning to partials. Shoehorn's `fromExact()` helper enforces full objects initially, allowing a safe switch to partials as needed later.

Does shoehorn work with existing test files that use partial objects and intentional type mismatches?

Yes, shoehorn works with existing test files using partial objects or intentional mismatches. The migration guide converts these files from unsafe `as` assertions to type-safe helpers like `fromPartial()` and `fromAny()` to improve overall test reliability.

Why should I migrate my TypeScript tests away from `as unknown as Type` assertions?

You should migrate TypeScript tests away from `as unknown as Type` assertions because they bypass compiler checks and reduce reliability. Using shoehorn's `fromAny()` and `fromPartial()` restores type safety and autocomplete while testing edge cases with partial data.