migrate-to-shoehorn

Migrate TypeScript test files from `as` assertions to @total-typescript/shoehorn.

1|Updated May 6, 2026
One-click install
npx skills add https://github.com/ThorStarlord/interface-skills --skill migrate-to-shoehorn-thorstarlord
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: migrate-to-shoehorn
Source: https://github.com/ThorStarlord/interface-skills/tree/main/skills/migrate-to-shoehorn
Command: npx skills add https://github.com/ThorStarlord/interface-skills --skill migrate-to-shoehorn-thorstarlord

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @total-typescript/shoehorn.

What problem does it solve?

This Skill helps you stop relying on brittle TypeScript as assertions in test code by migrating those patterns to @total-typescript/shoehorn, improving type safety and reducing the effort needed to construct test data.

Core Features & Use Cases

  • Replace as Type with fromPartial() for passing only the properties your test actually uses while still type-checking.
  • Replace as unknown as Type with fromAny() for intentionally wrong data when testing error paths.
  • Swap to fromExact() when you need full objects, while keeping a clear migration path back to fromPartial().

Quick Start

Ask an AI to migrate your test files by replacing as Type with fromPartial(), replacing as unknown as Type with fromAny(), and wiring up the required imports from @total-typescript/shoehorn.

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 type assertions in TypeScript test files with type-safe helpers?▼

You can migrate TypeScript test files by replacing `as Type` assertions with `fromPartial()` and `as unknown as Type` with `fromAny()` from @total-typescript/shoehorn, adding the required imports to keep tests type-safe and less brittle.

What is the best way to pass partial objects in TypeScript tests without using `as` assertions?▼

Using `fromPartial()` from @total-typescript/shoehorn allows you to pass only the properties your test actually uses while still type-checking, replacing the need for unsafe `as Type` casts when constructing partial request objects or large shapes.

How do I test error paths in TypeScript with intentionally wrong payloads without `as unknown as Type`?▼

You can replace `as unknown as Type` assertions with `fromAny()` from @total-typescript/shoehorn to safely pass intentionally wrong data when testing error paths, ensuring your negative testing remains type-safe and explicit.

When should I use `fromExact()` instead of `fromPartial()` for TypeScript test data?▼

Use `fromExact()` from @total-typescript/shoehorn when you need full-object enforcement in your tests, keeping a clear migration path back to `fromPartial()` for cases where only a few relevant properties are needed.

Does @total-typescript/shoehorn support migrating existing test files that rely heavily on `as` type assertions?▼

Yes, you can migrate existing test files by replacing `as Type` with `fromPartial()`, replacing `as unknown as Type` with `fromAny()`, and wiring up the required imports from @total-typescript/shoehorn to improve type safety and reduce test brittleness.