cyberneticlibrary

Replace type assertions in test code

migrate-to-shoehornskillsetup L1194
amazingloft999-droid/mattpocock-skills
What it does

Replace TypeScript `as` type assertions in tests with type-safe @total-typescript/shoehorn

Best for

Test suites with large mock objects where only a few properties matter and traditional `as` is heavy-handed

Inputs
  • · test files with `as Type` or `as unknown as Type` assertions
Outputs
  • · refactored test files using fromPartial() or fromAny()
Requires
  • · @total-typescript/shoehorn
Preconditions

Test files use TypeScript; npm/yarn package manager available

Failure modes

fromExact() forces full objects—use only for swap-back; loses intentional wrong-data semantics if fromAny() omitted

Trust signals
  • · Total TypeScript author (Matt Pocock) pattern
  • · Maintains autocomplete even with fromAny()
  • · Works with partial + wrong-type scenarios