Skip to content
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

toRef type error - says it unwraps refs but doesn't #4732

Closed
denovodavid opened this issue Oct 3, 2021 · 0 comments · Fixed by #4734
Closed

toRef type error - says it unwraps refs but doesn't #4732

denovodavid opened this issue Oct 3, 2021 · 0 comments · Fixed by #4734
Labels
🐞 bug Something isn't working scope: types

Comments

@denovodavid
Copy link

Version

3.2.19

Reproduction link

codesandbox.io

Steps to reproduce

  1. Create a shallowReactive object with a deeply nested ref.
  2. Extract a property from it using toRef.
  3. Try to access the nested ref value.

What is expected?

The toRef type is a shallow unwrap, or it actually unwraps the nested ref.

What is actually happening?

The toRef type states the nested ref has been unwraped, when it has not been.


I ran into this issue when I was passing a prop down to a component which mirrors this setup. The props object is equivalent to the shallow reactive object and I wanted to get a ref to my prop, but then typescript started yelling at me.

@edison1105 edison1105 added 🐞 bug Something isn't working scope: types labels Oct 4, 2021
caozhong1996 added a commit to caozhong1996/vue-next that referenced this issue Oct 4, 2021
yyx990803 added a commit that referenced this issue Oct 8, 2021
* fix(types): make `toRef` return correct type(fix #4732)

* chore: use correct test

Co-authored-by: Evan You <yyx990803@gmail.com>
@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐞 bug Something isn't working scope: types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants