fix(types): support non-DOM runtime declarations - #659
Merged
jerome-benoit merged 1 commit intoSep 5, 2026
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
jerome-benoit
force-pushed
the
fix/non-dom-declaration-compatibility
branch
from
September 5, 2026 11:44
45d8aef to
ba030b6
Compare
Co-authored-by: michalius <48828911+michalius@users.noreply.github.com>
jerome-benoit
force-pushed
the
fix/non-dom-declaration-compatibility
branch
from
September 5, 2026 11:58
ba030b6 to
393ab16
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BenchEventdeclaration compatible with runtimes whoseEventconstructor is not exposed throughtypeof globalThisperformanceNowas the existingNowFncontract so the declaration returnsnumberinstead of leakingDOMHighResTimeStampskipLibCheck: false, while preserving the literalBenchEvent.typecontractRoot cause
Two source-level DOM details leaked into the public declaration bundle:
BenchEvent extends globalThis.Eventwas emitted verbatim. Wrangler-generated Workerd declarations provide the globalEventtype, but do not exposeEventas a property oftypeof globalThis.performance.now.bind(...)had no explicit annotation, so TypeScript inferred the DOM aliasDOMHighResTimeStampinstead of Tinybench's runtime-neutralNowFnreturn type.The existing Workerd consumer inherited
skipLibCheck: truefrom the root configuration. It validated listener call sites but did not validatedist/index.d.ts, allowing both ambient-type leaks through. These two diagnostics predated and were explicitly out of scope for #646.Design
EventBaseconstruct signature that omits only the basetypemember, then retainBenchEvent<K>["type"]asKperformanceNowwithNowFn; runtime behavior stays unchangedskipLibCheckin the permanent Workerd declaration consumerVerification
pnpm typecheck:workerdpnpm test— 64 files, 243 tests passedpnpm typecheckpnpm lintpnpm lint:typedocpnpm buildCloses #658.