at main
1 folder
13 files
fix(worker): fix the 26 production type errors and gate all of src in CI
worker/tsconfig.check.json gated 18 of 45 files. The 7 ungated production files
were the load-bearing ones — index, http-router, both Durable Objects,
alert-service, auction-service, analytics-query-service — so CI type-checked
everything except the code that fires alerts and imports data.
Root causes rather than symptoms:
- tsconfig targeted es2021, whose lib does not declare ErrorOptions, so every
'new Error(msg, { cause })' failed. Four errors from one config line; module
was already es2022 and workerd is well past it.
- Both DOs redeclared ctx/env on top of DurableObject's own protected members.
Parameterizing the generic (DurableObject<AuctionImportEnv>) lets the base
declare them at the right types. Six errors.
- http-router took triggerAuctionImport as () => Promise<unknown>, so the result
could not be spread and the failure could not be read. Typed against
AuctionImportResult, with isAuctionImportFailure to narrow the thrown value.
Two real bugs the checker had been catching:
- auction-service's no-valid-data path returned only 4 of the 9 declared fields,
so callers reading fetched/timestamp got undefined.
- the success path omitted timestamp entirely, despite computing it two lines
above and declaring it in the return type.
Both tests that asserted the incomplete shapes are updated — they had been
pinning the bug.
tsconfig.check.json now includes src/**/*.ts and excludes only src/__tests__,
so a new production file is gated by default instead of silently exempt. 26
files checked, up from 18. The ~236 remaining errors are all in test mocks and
stay tracked in the spec.
fix(worker): fix the 26 production type errors and gate all of src in CI
worker/tsconfig.check.json gated 18 of 45 files. The 7 ungated production files
were the load-bearing ones — index, http-router, both Durable Objects,
alert-service, auction-service, analytics-query-service — so CI type-checked
everything except the code that fires alerts and imports data.
Root causes rather than symptoms:
- tsconfig targeted es2021, whose lib does not declare ErrorOptions, so every
'new Error(msg, { cause })' failed. Four errors from one config line; module
was already es2022 and workerd is well past it.
- Both DOs redeclared ctx/env on top of DurableObject's own protected members.
Parameterizing the generic (DurableObject<AuctionImportEnv>) lets the base
declare them at the right types. Six errors.
- http-router took triggerAuctionImport as () => Promise<unknown>, so the result
could not be spread and the failure could not be read. Typed against
AuctionImportResult, with isAuctionImportFailure to narrow the thrown value.
Two real bugs the checker had been catching:
- auction-service's no-valid-data path returned only 4 of the 9 declared fields,
so callers reading fetched/timestamp got undefined.
- the success path omitted timestamp entirely, despite computing it two lines
above and declaring it in the return type.
Both tests that asserted the incomplete shapes are updated — they had been
pinning the bug.
tsconfig.check.json now includes src/**/*.ts and excludes only src/__tests__,
so a new production file is gated by default instead of silently exempt. 26
files checked, up from 18. The ~236 remaining errors are all in test mocks and
stay tracked in the spec.