Skip to content

Error in type as if ref was not unwrapped in <template> when a composable is not destructured #5314

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

Closed
twisterniq opened this issue Apr 10, 2025 · 1 comment

Comments

@twisterniq
Copy link

twisterniq commented Apr 10, 2025

Vue - Official extension or vue-tsc version

v3.0.0-alpha.4

VSCode version

1.98.2

Vue version

3.5.13

TypeScript version

5.8.2

System Info

package.json dependencies

Steps to reproduce

  1. Create a basic composable with a boolean ref.
  2. Assign the composable value to a variable in <script setup>.
  3. Try to it the ref from the composable in <template>.
  4. The ref is not unwrapped and expects you to add .value to it, but that seems not correct because then it does not work.

What is expected?

Type should be the ref unwrapped in <template>.

What is actually happening?

Type of the red is not unwrapped in <template>.

Image

Link to minimal reproduction

https://play.vuejs.org/#eNp9Uk1vEzEQ/SsjXxqkZPcAp3SLaFEl4AAVcPRl2cwGF69t2eMQFO1/Z+z9SqDtIcrOzJuZ53nvJG6dKw4RxVZUofHKEQSk6N5KU5bwjsKm+YnNL2lU56wneG87B623HVwVZQpS89X1XD9BDJjyNtQ/NEI/gy/yqUOaxppA0Czom8vu1SuGVeXAixlxQNg5XRNyBFBlNlsVNnVD6oA3UizDChVuc1YKKBlelWe9Yi0o8PpW7YvHYA0//5QmDgOURv/FkWJ6UmwhV1Kt1tr+/pRz5COup3w+0RP5x3BMOSkePAb0icpco9rvkYby/bfPeOTvudjZXdSMfqH4FYPVMXEcYHfR7Jj2GS6z/ZhlUWb/PdwfCU2YHpWIJmSf8VKwjOmazz19ofu6eJP7pOn5ihd68Sn5kLMTPLaT/nm+FNfSs4r8w2PGtNGwRNb8KzvvZRCwNZJBJiHZHjxylZizMcZJwDmK3kwtMMPXQ6LP0MR1suv/XmfADltl8MFbF1bjqGlQOsM4m/44Du+s1VibcQEA99ZR0xbaWod5b/7vB6aLiUfaZ0bO6GqnDnDYqJY9vBh3LAJ8QBZzCqqSwbl05mnR/wVBAEub

Any additional comments?

Not sure if this is actually an error or not. I would expect the ref to be automatically unwrapped as when you destructure the composable.

@twisterniq twisterniq changed the title Refs not unwrapped in <template> when a composable is not destructured Error in type as if ref was not unwrapped in <template> when a composable is not destructured Apr 10, 2025
@twisterniq
Copy link
Author

Sorry, it seems like it's not an error, didn't know that.

Docs: https://vuejs.org/guide/essentials/reactivity-fundamentals.html#caveat-when-unwrapping-in-templates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant