Skip to content

fix(kit): restore rpc module augmentation - #551

Merged
antfu merged 1 commit into
mainfrom
fix/rpc-module-augmentation
Aug 27, 2026
Merged

fix(kit): restore rpc module augmentation#551
antfu merged 1 commit into
mainfrom
fix/rpc-module-augmentation

Conversation

@webfansplz

Copy link
Copy Markdown
Member

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-kit no longer affected rpc.call().

This PR:

  • restores DevToolsRpcServerFunctions as an augmentable Kit interface
  • rebinds call, callEvent, and callOptional on the Kit RPC client
  • keeps the runtime behavior unchanged
  • adds a TypeScript regression fixture covering custom names, return types, and argument validation

The fix is intentionally scoped to Vite DevTools Kit. Devframe's native module augmentation continues to work without changes.

Copilot AI lite review requested due to automatic review settings August 27, 2026 07:38
@pkg-pr-new

pkg-pr-new Bot commented Aug 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@551

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@551

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@551

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@551

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@551

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@551

commit: 802691c

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 DevToolsRpcServerFunctions interface in the Kit types surface.
  • Rebinds call, callEvent, and callOptional on 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.

Comment thread test/rpc-augmentation.test.ts
@antfu
antfu merged commit c008f24 into main Aug 27, 2026
11 checks passed
@antfu
antfu deleted the fix/rpc-module-augmentation branch August 27, 2026 10:42
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.

RPC module augmentation stopped working in 0.4.x

3 participants