Skip to content

test(event-bus-client): add type tests for 'EventClient' and enable vitest 'typecheck' - #612

Merged
sukvvon merged 1 commit into
mainfrom
chore/event-bus-client-type-tests
Dec 5, 2026
Merged

sukvvon merged 1 commit into
mainfrom
chore/event-bus-client-type-tests

Conversation

@sukvvon

@sukvvon sukvvon commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

🎯 Changes

  • Add packages/event-bus-client/tests/index.test-d.ts with type tests for EventClient:
    • The root and production entries expose the same EventClient type.
    • emit infers the payload type from the event name, and rejects a mismatched payload or an unknown event name.
    • on infers the callback event type from the event name, returns () => void, and rejects an unknown event name.
    • onAllPluginEvents passes the union of plugin events, and narrowing on event.type narrows the payload.
    • onAll passes TanStackDevtoolsEvent<string, any>.
  • Enable typecheck in packages/event-bus-client/vite.config.ts, so vitest runs the *.test-d.ts files as type tests.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Added type checks for event names, callbacks, cleanup functions, and consistency between package entry points.
    • Enabled typechecking in the test configuration.

@sukvvon sukvvon self-assigned this Dec 5, 2026
@changeset-bot

changeset-bot Bot commented Dec 5, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c88c593

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@nx-cloud

nx-cloud Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit c88c593

Command Status Duration Result
nx affected --targets=test:oxlint,test:sherif,t... ✅ Succeeded 3m 18s View ↗
nx run-many --target=test:e2e --parallel=1 --pr... ✅ Succeeded 1m 25s View ↗
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 45s View ↗

💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-12-05 03:18:58 UTC

@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request adds type tests for EventClient and enables typechecking in the Vitest configuration.

Changes: Event client type coverage

Layer / File(s) Summary
Event client type checks
packages/event-bus-client/tests/index.test-d.ts, packages/event-bus-client/vite.config.ts
Adds type assertions for entry-point equivalence, event payloads, listener cleanup, and callback event types. Enables Vitest typechecking.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Suggested reviewers: alemtuzlak

Merge Risk: Minimal · up to c88c5

This change adds type tests and turns on type checking for the event client package. It does not alter runtime behavior, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two main changes: type tests for EventClient and enabling Vitest typecheck. It matches the changeset, which adds packages/event-bus-client/tests/index.test-d.ts and sets typecheck.…
Description check Passed The description follows the template. It has a Changes section that lists the new type tests for EventClient and the vite.config.ts typecheck change, with the motivation implied. The checklist items a…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two main changes: type tests for EventClient and enabling Vitest typecheck. It matches the changeset, which adds packages/event-bus-client/tests/index.test-d.ts and sets typecheck.enabled in vite.config.ts. The title is specific and follows a conventional commit style.

Full details: Description check

Explanation

The description follows the template. It has a Changes section that lists the new type tests for EventClient and the vite.config.ts typecheck change, with the motivation implied. The checklist items are marked, and the release impact section marks the change as docs/CI/dev-only with no release. The description is complete. The template's Changes section asks for motivation, which is only implied, but this is a minor gap.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 39e7210 and c88c593.

Files selected for processing: 2

  • packages/event-bus-client/tests/index.test-d.ts
  • packages/event-bus-client/vite.config.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@pkg-pr-new

pkg-pr-new Bot commented Dec 5, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-devtools

npm i https://pkg.pr.new/@tanstack/angular-devtools@612

@tanstack/devtools

npm i https://pkg.pr.new/@tanstack/devtools@612

@tanstack/devtools-a11y

npm i https://pkg.pr.new/@tanstack/devtools-a11y@612

@tanstack/devtools-bundler-core

npm i https://pkg.pr.new/@tanstack/devtools-bundler-core@612

@tanstack/devtools-client

npm i https://pkg.pr.new/@tanstack/devtools-client@612

@tanstack/devtools-rspack

npm i https://pkg.pr.new/@tanstack/devtools-rspack@612

@tanstack/devtools-ui

npm i https://pkg.pr.new/@tanstack/devtools-ui@612

@tanstack/devtools-utils

npm i https://pkg.pr.new/@tanstack/devtools-utils@612

@tanstack/devtools-vite

npm i https://pkg.pr.new/@tanstack/devtools-vite@612

@tanstack/devtools-webmcp

npm i https://pkg.pr.new/@tanstack/devtools-webmcp@612

@tanstack/devtools-event-bus

npm i https://pkg.pr.new/@tanstack/devtools-event-bus@612

@tanstack/devtools-event-client

npm i https://pkg.pr.new/@tanstack/devtools-event-client@612

@tanstack/preact-devtools

npm i https://pkg.pr.new/@tanstack/preact-devtools@612

@tanstack/react-devtools

npm i https://pkg.pr.new/@tanstack/react-devtools@612

@tanstack/solid-devtools

npm i https://pkg.pr.new/@tanstack/solid-devtools@612

@tanstack/svelte-devtools

npm i https://pkg.pr.new/@tanstack/svelte-devtools@612

@tanstack/vue-devtools

npm i https://pkg.pr.new/@tanstack/vue-devtools@612

commit: c88c593

@sukvvon
sukvvon merged commit 892662d into main Dec 5, 2026
11 checks passed
@sukvvon
sukvvon deleted the chore/event-bus-client-type-tests branch December 5, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant