Skip to content

Conversation

cszhjh
Copy link
Contributor

@cszhjh cszhjh commented Aug 31, 2025

It shows a type error in my editor.
Strangely, pnpm run check does not report an error, but if I change it as follows, running pnpm run check will produce an error.

export function proxyRefs<T extends object>(
  objectWithRefs: T,
): ShallowUnwrapRef<T> {
  if (isReactive(objectWithRefs)) {
    return objectWithRefs
  }
  return new Proxy(objectWithRefs, shallowUnwrapHandlers)
}
ad2c3246b3ca307f372333a2c26e3835

Summary by CodeRabbit

  • New Features

    • No user-facing features added in this release.
  • Refactor

    • Improved TypeScript type safety for ref unwrapping in reactive proxies to better align with declared return types. This enhances developer tooling, autocomplete, and error checking without changing runtime behavior.
  • Bug Fixes

    • None.
  • Chores

    • No action required for users; APIs and behavior remain unchanged. No migration needed.

Copy link

coderabbitai bot commented Aug 31, 2025

Walkthrough

Type-only adjustment in proxyRefs: when the target is reactive, the returned value is now explicitly cast to ShallowUnwrapRef via (objectWithRefs as ShallowUnwrapRef). No runtime logic or API signatures changed.

Changes

Cohort / File(s) Summary
Type annotation adjustment
packages/reactivity/src/ref.ts
Added explicit TypeScript cast to ShallowUnwrapRef on the reactive-path return value in proxyRefs; no runtime behavior changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

I nudge my specs with twitchy glee,
A tiny cast for type safety.
No wires moved, no gears re-spun—
Just TS purring, checks well-done.
Thump-thump! my paws approve the feat:
Ref unwraps steady, typings neat.

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 24fccb4 and 8d5ad33.

📒 Files selected for processing (1)
  • packages/reactivity/src/ref.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/reactivity/src/ref.ts (2)
packages/runtime-core/src/index.ts (1)
  • ShallowUnwrapRef (208-208)
packages/reactivity/src/index.ts (1)
  • ShallowUnwrapRef (19-19)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Redirect rules
  • GitHub Check: Header rules
  • GitHub Check: Pages changed
  • GitHub Check: test / e2e-test
🔇 Additional comments (1)
packages/reactivity/src/ref.ts (1)

274-280: Verify proxyRefs return type
Automated type-checking failed with TS2688 (Cannot find type definition file for 'node'), preventing confirmation. Please manually ensure proxyRefs returns ShallowUnwrapRef<T> in both branches (e.g. cast the full ternary or each branch as shown).

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 101 kB 38.4 kB 34.6 kB
vue.global.prod.js 159 kB 58.5 kB 52.2 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.5 kB 18.2 kB 16.7 kB
createApp 54.5 kB 21.2 kB 19.4 kB
createSSRApp 58.7 kB 22.9 kB 20.9 kB
defineCustomElement 59.5 kB 22.8 kB 20.8 kB
overall 68.5 kB 26.4 kB 24 kB

Copy link

pkg-pr-new bot commented Aug 31, 2025

Open in StackBlitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@13836

@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@13836

@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@13836

@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@13836

@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@13836

@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@13836

@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@13836

@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@13836

@vue/shared

npm i https://pkg.pr.new/@vue/shared@13836

vue

npm i https://pkg.pr.new/vue@13836

@vue/compat

npm i https://pkg.pr.new/@vue/compat@13836

commit: 8d5ad33

@edison1105
Copy link
Member

Thanks for the PR, but this is already addressed in #12973

@cszhjh cszhjh closed this Sep 1, 2025
@cszhjh cszhjh deleted the types/proxyRefs branch September 1, 2025 06:51
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.

2 participants