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

Set wrapped with Ref Ractive, there will be type problems with the has add ... method. #9755

Closed
skywalker512 opened this issue Dec 5, 2023 · 2 comments

Comments

@skywalker512
Copy link

skywalker512 commented Dec 5, 2023

Vue version

3.3.10

Link to minimal reproduction

https://play.vuejs.org/#eNqNUk2P0zAU/CuWL02k1mG1t1LQAtoDHACx3DAHN3lpvcQfsl/SSlX/O8/xNtuW1Yqb35vxzHjkA//gvRh64Eu+inXQHlkE7P17abXxLiA7sACqRj3AnE4tO7I2OMNmdGkmrbS1sxGZY+/YQVrG1DKxiptS2uMzrAhOaws79gBY/HK/S2Kc4PUIZ5d/Oa0LrMjEmrmWKTGorocyGybAdSA6tylmKeBWxdn8RBI0Fa68nOuyfPsU71p7/bJqjvYkvZ5E82mSW1W5QiqPBgTjO4VA06o6G/icYyT9Vm/EY3SWqh8tJa+d8bqD8M2jJn/JlzlMwlTXud2XcYehh/lpX2+h/vPC/jHu007y7wEihAEknzBUYQOY4fuHr7Cn8wQa1/QdsV8BfwB106eMmfaxtw3FPuONaT+PH0jbzc94v0ew8fSoFDQxjyNfcvpKn155+nPcW3E73qO2qcX8QRdG+aseM3ApQh457BbRx2VV1Y2law10egjCAlbWm+qOaFXoLWoDi8aZO3IUN2+qRkc83wuIZrEObkfVCh9cQ1Jnz08qY+lhEcA2EFI5/2d+de0iwBV2ESL5T90c/wK0l0rg

Steps to reproduce

  • code
image
  • log
image

What is expected?

No type errors.

What is actually happening?

It should be caused by this commit: #8960 This commit resolves the issue with ref (it should behave as expected when accessed), but it does not work correctly in the has method of Set.

image

System Info

No response

Any additional comments?

No response

@pikax
Copy link
Member

pikax commented Dec 5, 2023

This is expected, we either have unwrapped or the original types on collections, to better reflect the code at runtime the #8960 is correct.

for (const c of a.value) {
  console.log('ref has', a.value.has(ref(o).value), a.value.has(ref(c).value));
}

for (const c of b) {
  console.log('reactive has', b.has(ref(o).value), b.has(ref(c).value));
}

if you wrap them into ref they will still log true true.

I don't think this issue should be fixed ATM and should wait for microsoft/TypeScript#43826 to do a revamp on get/set

@skywalker512
Copy link
Author

Thank you for your answer.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants