Type issue when initializing a ref() with an object that includes router types
#2373
-
|
I'm currently facing an issue where TS complains about incorrect types when initializing a The code looks something like this: Now TS is complaining that Also, I only encounter this error with Reproduction: Vue SFC Playground (see |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
You should pass the type param to |
Beta Was this translation helpful? Give feedback.
I thought about that and while the error does indeed disappear, it's but only because
baris actually not of typeFooTypein this case. So it becomes an issue when e.g. passingbarto a function that expects a parameter of typeFooType: Check here.I guess the difference is because Vue is unwrapping refs when resolving them. Also see https://github.com/orgs/vuejs/discussions/9564#discussioncomment-7518938.