the Ref type seem to unwrap deeply nested ref when it should not #12219
Unanswered
4dr1en
asked this question in
Help/Questions
Replies: 1 comment
-
It's bascause Vue's type system automatically infers and unwraps nested ref types. So there's no need to explicitly decalre the variable's type. Vue's type system is smart enough to infer the correct type based on the value passed to ref() Just simply write like this: const foo = ref<Foo>([]); It works, right ? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm encountering a TypeScript error when trying to use a Ref inside an array of objects. In my code, r should be a Ref, but it's being treated as a boolean. Here's the simplified code:
Error:
Types of property 'r' are incompatible.
Type 'boolean' is not assignable to type 'Ref<boolean, boolean>'
Beta Was this translation helpful? Give feedback.
All reactions