·
Last changedVersion:
This version passed the hardening gate. Hardening applied 7 targeted changes and preserved all other text. Classified findings before hardening: 0. Classified findings closed: 0. Classified findings remaining: 0. Unclassified scanner findings remaining: 0. Review findings closed: 11. Review findings remaining: 1.
None
None
Expand | File | Group | Subtype | Severity | Status |
|---|
No findings available
0 findings
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:
as unknown as Type) for intentionally wrong dataAdd the package as a development dependency only, since it is for test code only. Pin an exact version the user has reviewed, or follow the existing project lockfile and version policy. If the project lockfile shows a different package manager, use that manager's equivalent development install instead of npm. Installing a package can run its install scripts, so show the user the exact install command and run it only after the user explicitly approves.
Before:
After:
as Type → fromPartial()Before:
After:
as unknown as Type → fromAny()Before:
After:
| Function | Use case |
|---|---|
| Pass partial data that still type-checks |
| Pass intentionally wrong data (keeps autocomplete) |
| Force full object (swap with fromPartial later) |
Gather requirements - ask user:
as assertions causing problems?Install and migrate:
npm i @total-typescript/shoehorn as a development dependency only, at an exact version the user has reviewed or as the project lockfile allows, using the package manager the project already usesas assertions: grep -r " as [A-Z]" --include="*.test.ts" --include="*.spec.ts"
as Type with fromPartial() only for test data passed to a typed parameter; where there is no contextual type, pass the target type to fromPartial() as a generic argument
as unknown as Type with fromAny() only where the wrong data is intentional@total-typescript/shoehorn@total-typescript/shoehornGet started with chainctlchainctl skill install public/mattpocock/migrate-to-shoehorn:latest
Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.
skills.chainreg.biz/public/github.com/mattpocock/skills/misc/migrate-to-shoehorn:latest
MIT
HARDENING.md
LICENSE
SKILL.md