migrate-to-shoehorn

Migrate TypeScript `as` assertions to @total-typescript/shoehorn wrappers.

1|Updated May 7, 2026
One-click install
npx skills add https://github.com/Soham407/studio-kickstart --skill migrate-to-shoehorn-soham407
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-to-shoehorn
Source: https://github.com/Soham407/studio-kickstart/tree/main/architecture/matt-pocock-migrate-to-shoehorn
Command: npx skills add https://github.com/Soham407/studio-kickstart --skill migrate-to-shoehorn-soham407

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @total-typescript/shoehorn.

What problem does it solve?

This Skill helps you remove brittle TypeScript as assertions from test code by migrating them to type-safe helpers from @total-typescript/shoehorn, reducing unsafe casts and improving test maintainability.

Core Features & Use Cases

  • Migrate as Type to fromPartial() for passing only the properties your test actually uses.
  • Migrate as unknown as Type to fromAny() when tests intentionally supply incorrect data for error paths.
  • Choose the right helper (fromPartial, fromAny, or fromExact) to match whether your test needs partial, intentionally wrong, or fully exact objects.

Quick Start

Use the migrate-to-shoehorn skill to find as-based type assertions in your test files and replace them with fromPartial or fromAny so your tests type-check without unsafe casts.

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 TypeScript 'as' type assertions in test files with type-safe wrappers?

To replace TypeScript 'as' type assertions in test files, migrate them to type-safe wrappers from @total-typescript/shoehorn. This removes brittle casts by applying fromPartial or fromAny based on whether your test needs partial objects or intentionally incorrect data.

What's the best way to pass partial objects in TypeScript tests without unsafe type casts?

The best way to pass partial objects without unsafe type casts is using fromPartial from @total-typescript/shoehorn. It replaces 'as Type' assertions, allowing you to pass only the properties your test actually uses while maintaining strict type checking.

When should I use fromAny instead of fromPartial for testing error paths in TypeScript?

Use fromAny instead of fromPartial when tests intentionally supply incorrect data to verify error handling. fromAny replaces 'as unknown as Type' patterns, ensuring type safety when passing wrong data types to test failure scenarios.

Does @total-typescript/shoehorn support migrating 'as unknown as Type' assertions for error handling tests?

Yes, @total-typescript/shoehorn supports migrating 'as unknown as Type' assertions via the fromAny wrapper. It targets unit and integration tests that intentionally pass incorrect data to verify error paths, replacing unsafe casts with type-checked wrappers.

Can I choose between fromPartial, fromAny, and fromExact when migrating test type casts?

You can choose between fromPartial, fromAny, and fromExact based on your test needs. fromPartial handles partial objects, fromAny manages intentionally wrong data for error paths, and fromExact enforces fully exact objects during the type cast migration process.

Why do my TypeScript tests break when removing 'as' assertions for large request objects?

TypeScript tests break when removing 'as' assertions because the compiler expects fully typed objects. Migrating to fromPartial lets you pass only the subset of properties your test actually uses, satisfying type requirements without unsafe casts.