You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ef45c2f
Browse filesBrowse the repository at this point in the historyBrowse files
test(rest): type the seven unchecked route.handler call sites in rest.test.ts (#15582)
`rest.test.ts` held five `const res = { json: vi.fn(), ... }` literals whose
enclosing `rest` / `route` binding was declared `any`, so `route.handler(req,
res)` checked neither argument. No repair to argument 1 could ever surface
them and `test-typecheck-debt.json` could never see them: they were green
because nothing looked, not because they conformed.
Typing the enclosing binding at all five turns that into a measurement:
- 3 of them (the `filterAppForUser` gate, the dashboard widget gate, and
the `readMeta` helper of the default-config gate) already supplied all
four members `IHttpResponse` requires. They CONFORM — tsc reports nothing
at those three call sites once argument 2 is actually checked.
- 2 of them supplied only `json` and `status`, and go red with exactly the
TS2345 `missing the following properties from type 'IHttpResponse': send,
header` that #13454 repaired and cleared from the ledger. Repaired the
same way: `httpResponseTestDouble()`.
Typing the shared `getPutRoute(rest, path)` helper also exposed 2 further
unchecked calls in the same describe block, at 1930 / 1954, that the census
pattern `const res = { json: vi.fn()` cannot see at all: their response is an
anonymous literal written at the argument position rather than bound to a
`const`. Same class, same two missing members, same repair.
Argument 1 is repaired at all seven with the package's own
`httpRequestForRoute(route!, …)` (#13377), because tsc reports at most one
argument-assignability error per call expression — leaving a request literal
missing `query` / `method` / `path` would simply mask argument 2 again and
put the sites back where they started.
`test-typecheck-debt.json` is untouched and stays empty: the shrink-only
ledger is not the place for an error a fixture can just stop having.
⛔ Not touched, deliberately: the 21 `res as any` sites (#13377 declined that
census for the request half and left 151 sites on purpose), and the mirrored
`makeRes()` fixtures — the three named files plus the in-file `invoke()`
helper at 4141 — where a mirror keeps only the LAST status while `mock.calls`
keeps every one, so substitution would change the assertion rather than the
fixture.
Claude-Session: https://claude.ai/code/session_01D47qPfEWVPmhguWgBZCi5N
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments