What is shoehorn and when should I use it?
mainshoehorn is a utility designed to let you pass partial or incorrect data into functions during testing while maintaining TypeScript safety and autocomplete.
It solves the problem of using the as keyword in tests, which is often discouraged and requires manual type assertion or 'double-casting' (as unknown as Type) when testing incorrect data.
Use cases include:
- Legacy codebases: When you cannot immediately refactor large, overly-broad types.
- Third-party libraries: When you cannot modify external types and want to avoid unnecessary wrapper functions.