-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
fix(types): unwrap custom symbols in Reactive #13740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(types): unwrap custom symbols in Reactive #13740
Conversation
WalkthroughA new test suite was added to verify that reactive unwrapping works for custom symbol keys as well as string keys. The internal type logic for unwrapping was updated to only exclude built-in symbol keys (not all symbols) from recursive unwrapping. A new exported type alias, Changes
Sequence Diagram(s)sequenceDiagram
participant Tester
participant ReactiveSystem
participant TypeSystem
Tester->>ReactiveSystem: Create reactive object with custom symbol and string keys (ref values)
ReactiveSystem->>TypeSystem: Apply UnwrapRefSimple logic
TypeSystem->>TypeSystem: Exclude built-in symbol keys from unwrapping
TypeSystem->>TypeSystem: Recursively unwrap custom symbol and string keys
TypeSystem-->>ReactiveSystem: Return object with unwrapped values
ReactiveSystem-->>Tester: Access properties, verify types are unwrapped
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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). (3)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
When using
reactive()
with an object that has symbol keys whose values areRef
s, the runtime correctly unwraps thoseRef
s (except for built-in well-known symbols), but the TypeScript type forReactive<>
does not reflect this behavior.As a result, TypeScript still infers the property type as
Ref<...>
even though at runtime you receive the raw value.Reproduction
This PR fixes this issue by changing the
symbol
checking logic inReactive<>
to only match builtin/well-known symbols. A test is added as well.Summary by CodeRabbit
Tests
Refactor