SKILL

migrate-to-shoehorn

Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.

Target: Software development & testing. Automatically collected · unverified.

Excerpt from the author’s documentation

Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.

Read the original English text

Topics in the source

  • Migrate to Shoehorn
  • Why shoehorn?
  • Install
  • Migration patterns
  • Large objects with few needed properties
  • as Type → fromPartial()
  • as unknown as Type → fromAny()
  • When to use each

shoehorn lets you pass partial data in tests while keeping TypeScript happy. It replaces as assertions with type-safe alternatives. Test code only. Never use shoehorn in production code. Problems with as in tests: Trained not to use it Must manually specify target type Double-as (as unknown as Type) for intentionally wrong data Before: After: Before: After: Before: After: | Function | Use case | | --------------- | -------------------------------------------------- | | fromPartial() | Pass partial data that still type-checks | | fromAny() | Pass intentionally wrong data (keeps autocomplete) | | fromExact() | Force full object (swap with fromPartial later) | 1. Gather requirements - ask user: What test files have as assertions causing problems? Are they dealing with large objects where only some properties matter? Do they need to pass intentionally wrong data for error testing? 2. Install and migrate: [ ] Install: npm i @total-typescript/shoehorn [ ] Find test files with as assertions: grep -r " as [A-Z]" --include=".test.ts" --include=".spec.ts" [ ] Replace as Type with fromPartial() [ ] Replace as unknown as Type with fromAny() [ ] Add imports from @total-typescript/shoehorn [ ] R

This is an excerpt. Refer to the complete source and its current requirements.

Source repository
mattpocock/skills
Source file
skills/misc/migrate-to-shoehorn/SKILL.md
Fixed revision
4ae2317ddb22b046e26455e4f9c9b3aaaf62212d
Read the complete original documentation ↗

Sources and evidence

This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.

Author: Matt Pocock Skills · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-10T21:01:24.526Z.

Categories are inferred from names, descriptions and paths. They do not establish compatibility.

License and attribution

MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.

Original license ↗

Synchronization, copying and user-reported success do not mark a resource as runtime-tested.

Limitations and notes

  • Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.