The deliberate type-breach boundary — and a suite's only one: call
sites hand over values the compiled types rightly refuse (wire
payloads carrying fields the schema forbids, partial doubles standing
in for rich runtime records) because that refusal is the behavior
under test. Prefer an honest shape where one exists (mock, a
typed vi.fn signature, a zod parse); reach for cast only when the
type error is the point. The value comes back untouched, typed
never so it is assignable anywhere.
The deliberate type-breach boundary — and a suite's only one: call sites hand over values the compiled types rightly refuse (wire payloads carrying fields the schema forbids, partial doubles standing in for rich runtime records) because that refusal is the behavior under test. Prefer an honest shape where one exists (mock, a typed
vi.fnsignature, a zod parse); reach forcastonly when the type error is the point. The value comes back untouched, typedneverso it is assignable anywhere.