Skip to content

test(*): add type tests for public APIs of all libraries and enable vitest 'typecheck' - #613

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

sukvvon merged 1 commit into
mainfrom
chore/type-tests

Conversation

@sukvvon

@sukvvon sukvvon commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

🎯 Changes

Add *.test-d.ts(x) type tests for the public APIs of the libraries, and enable typecheck in each package's vite.config.ts so vitest runs them as type tests.

  • devtools: TanStackDevtoolsPlugin render and name callback arguments, required render, and TanStackDevtoolsCore rejecting unknown config options.
  • devtools-a11y: the root and production entries of core, react and solid expose the same types.
  • devtools-client: devtoolsEventClient infers emit and on payloads from its event map and rejects unknown events or mismatched payloads.
  • devtools-ui: JsonTree rejects collapsePaths that do not exist or point to a primitive, and Select infers the onChange value from its options.
  • devtools-utils: create{React,Preact,Solid,Vue,Svelte,Angular}{Panel,Plugin} panel/plugin props, no-op variants matching the real ones, render signatures, and required components.
  • devtools-vite / devtools-rspack: defineDevtoolsConfig keeps the config type and rejects unknown options, unknown console levels and enhancedLogs without enabled; devtools parameter and return types.
  • devtools-webmcp: the root and production registerDevtoolsTools share a type, return a cleanup function, type DevtoolsTool input, and require pluginId.
  • react-devtools, preact-devtools, solid-devtools, vue-devtools, svelte-devtools, angular-devtools: plugin types accept the supported render / component forms with typed callback arguments, and require render / component.
  • Add tests to the include of packages/devtools-rspack/tsconfig.json.
  • Add vue to the ignoreDependencies of packages/devtools-utils in knip.json, since the Vue type test imports its types.

✅ 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
    • Expanded TypeScript checks across framework integrations, plugins, configuration options, and UI components.
    • Added checks for valid inputs, inferred types, required properties, and unsupported options to help catch type compatibility issues earlier.
    • Enabled typechecking in test suites across the devtools packages.

@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: 248c2a4

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

@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 Vitest compile-time type tests across devtools packages and enables typechecking in their Vitest configurations. The tests cover core APIs, framework integrations, utility factories, UI components, and package entry types.

Changes: Package API type checks

Layer / File(s) Summary
Core, event, and tool API contracts
packages/devtools/tests/index.test-d.ts, packages/devtools/vite.config.ts, packages/devtools-client/tests/index.test-d.ts, packages/devtools-client/vite.config.ts, packages/devtools-webmcp/tests/index.test-d.ts, packages/devtools-webmcp/vite.config.ts
Type tests check core plugin and configuration types, event payloads, and WebMCP registration types. Vitest typechecking is enabled in these packages.
Bundler configuration and plugin APIs
packages/devtools-rspack/tests/index.test-d.ts, packages/devtools-rspack/tsconfig.json, packages/devtools-rspack/vite.config.ts, packages/devtools-vite/tests/index.test-d.ts, packages/devtools-vite/vite.config.ts
Type tests check Rspack and Vite configuration options and plugin return types. Rspack includes its tests in the TypeScript project, and both packages enable Vitest typechecking.
Framework devtools plugin contracts
packages/angular-devtools/tests/types.test-d.ts, packages/angular-devtools/vite.config.ts, packages/preact-devtools/tests/devtools.test-d.tsx, packages/preact-devtools/vite.config.ts, packages/react-devtools/tests/devtools.test-d.tsx, packages/react-devtools/vite.config.ts, packages/solid-devtools/tests/core.test-d.ts, packages/solid-devtools/vite.config.ts, packages/svelte-devtools/tests/types.test-d.ts, packages/svelte-devtools/vite.config.ts, packages/vue-devtools/tests/types.test-d.ts, packages/vue-devtools/vite.config.ts
Tests check framework plugin shapes, callback types, and required properties. The package Vitest configurations enable typechecking.
Framework utility factory types
packages/devtools-utils/tests/angular.test-d.ts, packages/devtools-utils/tests/preact.test-d.ts, packages/devtools-utils/tests/react.test-d.ts, packages/devtools-utils/tests/solid.test-d.ts, packages/devtools-utils/tests/svelte.test-d.ts, packages/devtools-utils/tests/vue.test-d.ts, packages/devtools-utils/vite.config.ts, knip.json
Tests check framework panel and plugin factory types, including inferred props, no-op return types, and required inputs. Vitest typechecking is enabled, and vue is added to the workspace’s ignored dependencies.
UI component types and entry exports
packages/devtools-a11y/tests/entries.test-d.ts, packages/devtools-a11y/vite.config.ts, packages/devtools-ui/tests/select.test-d.ts, packages/devtools-ui/tests/tree.test-d.ts
Tests check type consistency between accessibility package root and production entries, Select callback inference, and valid JsonTree paths. Vitest typechecking is enabled for the accessibility package.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Possibly related PRs

  • TanStack/devtools#611: It changes the devtools-ui type tests and Vitest typecheck setup that this pull request also updates.

Suggested reviewers: alemtuzlak, ryansolid, kevinvandy

Merge Risk: Minimal · up to 248c2

This PR adds compile-time type tests and turns on Vitest typechecking across the devtools packages. It does not change runtime behavior or shipped code. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two main changes: adding type tests for the public APIs of all libraries and enabling Vitest typecheck. The raw summary and PR objectives confirm both, with type tests (*.test-d.ts…
Description check Passed The description follows the repository template. It has a Changes section that lists each affected package and explains the motivation. The checklist items are filled in, and the release impact is mar…
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: adding type tests for the public APIs of all libraries and enabling Vitest typecheck. The raw summary and PR objectives confirm both, with type tests (.test-d.ts(x)) across packages and typecheck.enabled in each vite.config.ts. The conventional 'test():' prefix is acceptable, and the title is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description follows the repository template. It has a Changes section that lists each affected package and explains the motivation. The checklist items are filled in, and the release impact is marked as docs/CI/dev-only. The description also covers the tsconfig.json include change and the knip.json ignoreDependencies change. The Changes section does not state the template's motivation sentence separately, but the first paragraph gives the purpose of the change.

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 892662d and 248c2a4.

Files selected for processing: 35

  • knip.json
  • packages/angular-devtools/tests/types.test-d.ts
  • packages/angular-devtools/vite.config.ts
  • packages/devtools-a11y/tests/entries.test-d.ts
  • packages/devtools-a11y/vite.config.ts
  • packages/devtools-client/tests/index.test-d.ts
  • packages/devtools-client/vite.config.ts
  • packages/devtools-rspack/tests/index.test-d.ts
  • packages/devtools-rspack/tsconfig.json
  • packages/devtools-rspack/vite.config.ts
  • packages/devtools-ui/tests/select.test-d.ts
  • packages/devtools-ui/tests/tree.test-d.ts
  • packages/devtools-utils/tests/angular.test-d.ts
  • packages/devtools-utils/tests/preact.test-d.ts
  • packages/devtools-utils/tests/react.test-d.ts
  • packages/devtools-utils/tests/solid.test-d.ts
  • packages/devtools-utils/tests/svelte.test-d.ts
  • packages/devtools-utils/tests/vue.test-d.ts
  • packages/devtools-utils/vite.config.ts
  • packages/devtools-vite/tests/index.test-d.ts
  • packages/devtools-vite/vite.config.ts
  • packages/devtools-webmcp/tests/index.test-d.ts
  • packages/devtools-webmcp/vite.config.ts
  • packages/devtools/tests/index.test-d.ts
  • packages/devtools/vite.config.ts
  • packages/preact-devtools/tests/devtools.test-d.tsx
  • packages/preact-devtools/vite.config.ts
  • packages/react-devtools/tests/devtools.test-d.tsx
  • packages/react-devtools/vite.config.ts
  • packages/solid-devtools/tests/core.test-d.ts
  • packages/solid-devtools/vite.config.ts
  • packages/svelte-devtools/tests/types.test-d.ts
  • packages/svelte-devtools/vite.config.ts
  • packages/vue-devtools/tests/types.test-d.ts
  • packages/vue-devtools/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.

@nx-cloud

nx-cloud Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 248c2a4

Command Status Duration Result
nx affected --targets=test:oxlint,test:sherif,t... ✅ Succeeded 3m 8s View ↗
nx run-many --target=test:e2e --parallel=1 --pr... ✅ Succeeded 1m 22s View ↗
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 42s 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 08:45:41 UTC

@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@613

@tanstack/devtools

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

@tanstack/devtools-a11y

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

@tanstack/devtools-bundler-core

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

@tanstack/devtools-client

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

@tanstack/devtools-rspack

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

@tanstack/devtools-ui

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

@tanstack/devtools-utils

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

@tanstack/devtools-vite

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

@tanstack/devtools-webmcp

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

@tanstack/devtools-event-bus

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

@tanstack/devtools-event-client

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

@tanstack/preact-devtools

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

@tanstack/react-devtools

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

@tanstack/solid-devtools

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

@tanstack/svelte-devtools

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

@tanstack/vue-devtools

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

commit: 248c2a4

@sukvvon
sukvvon merged commit 3ffb4af into main Dec 5, 2026
11 checks passed
@sukvvon
sukvvon deleted the chore/type-tests branch December 5, 2026 08:50
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