What problem does it solve?
This Skill addresses the common pain point of using unsafe manual as type assertions in TypeScript test files, which require developers to manually specify target types, fake all properties of large objects even when only a few are needed, and use double as unknown as Type casts for intentionally incorrect test data, all of which reduce test maintainability and type safety.
Core Features & Use Cases
- Safe Partial Data Passing: Replaces as Type assertions with the fromPartial() function to pass only the required properties of large objects in tests, eliminating the need to fake unused fields.
- Intentional Invalid Data Support: Replaces double as unknown as Type casts with the fromAny() function to pass intentionally incorrect test data for error scenario testing while retaining autocomplete support.
- Use Case Example: When testing a function that accepts a 20+ property request object but only requires the body.id field, this Skill removes the need to define all 20 unused properties in test mocks.
Quick Start
Use the migrate-to-shoehorn skill to replace all as type assertions in your TypeScript test files with the appropriate @total-typescript/shoehorn functions for your use case.