fix(kit): restore rpc module augmentation - #551
Merged
Conversation
@vitejs/devtools
@vitejs/devtools-kit
@vitejs/devtools-oxc
@vitejs/devtools-rolldown
@vitejs/devtools-vite
@vitejs/devtools-vitest
commit: |
Contributor
There was a problem hiding this comment.
Pull request overview
Restores TypeScript module augmentation support for custom RPC function names in @vitejs/devtools-kit, ensuring getDevToolsRpcClient().call() is typed against the Kit’s augmentable registry rather than Devframe’s base registry (fixes #550).
Changes:
- Reintroduces an augmentable
DevToolsRpcServerFunctionsinterface in the Kit types surface. - Rebinds
call,callEvent, andcallOptionalon the Kit RPC client type to use the Kit registry. - Adds a TypeScript regression fixture/test validating custom RPC names, return typing, and argument checking.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/rpc-augmentation.test.ts | Adds a TS-program-based regression test to ensure Kit augmentation affects rpc.call() typing. |
| test/fixtures/rpc-augmentation.ts | Provides a fixture that augments DevToolsRpcServerFunctions and asserts expected type behavior. |
| test/snapshots/tsnapi/@vitejs/devtools-kit/client.snapshot.d.ts | Updates the public API snapshot to reflect the new DevToolsRpcClient surface and return type. |
| packages/kit/src/types/rpc-augments.ts | Introduces an augmentable Kit-owned DevToolsRpcServerFunctions interface extending Devframe’s registry. |
| packages/kit/src/types/index.ts | Exposes the new augmentation interface from the Kit types barrel and stops aliasing Devframe’s server registry. |
| packages/kit/src/client/index.ts | Adjusts client exports so the Kit’s RPC client types come from the Kit wrapper rather than Devframe re-exports. |
| packages/kit/src/client/connection.ts | Defines DevToolsRpcClient* call types bound to DevToolsRpcServerFunctions and returns DevToolsRpcClient from getDevToolsRpcClient(). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
antfu
approved these changes
Aug 27, 2026
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.
Fixes #550
Restores module augmentation for custom RPC function names declared through
DevToolsRpcServerFunctions.The Kit type had become a renamed re-export of Devframe's RPC registry, while
getDevToolsRpcClient()returned a client typed directly against the Devframe registry. As a result, augmenting@vitejs/devtools-kitno longer affectedrpc.call().This PR:
DevToolsRpcServerFunctionsas an augmentable Kit interfacecall,callEvent, andcallOptionalon the Kit RPC clientThe fix is intentionally scoped to Vite DevTools Kit. Devframe's native module augmentation continues to work without changes.