Types appear broken and not unwrapping refs in getters #2485
Unanswered
silverbackdan
asked this question in
Help and Questions
Replies: 3 comments 4 replies
-
@posva - can I ask why a discussion when it's a regression on typing? |
Beta Was this translation helpful? Give feedback.
4 replies
-
If anyone comes across this issue, the fix is making sure your versions of |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm getting the same issue, trying to update vue and pinia to latest doesn't work. |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Reproduction
https://github.com/components-web-app/cwa-nuxt-module/tree/nuxt3/src/runtime/storage/stores/resources
Steps to reproduce the bug
I have defined a store like this:
https://github.com/components-web-app/cwa-nuxt-module/blob/nuxt3/src/runtime/storage/stores/resources/resources-store.ts
You can see the types I'm declaring here which was originally created as shorthands for types which were only internal:
https://github.com/components-web-app/cwa-nuxt-module/blob/nuxt3/src/runtime/storage/stores/cwa-store-types.d.ts
When creating a store like this e.g.:
Typescript is now expecting me to access getters like:
Whereas it typed it properly before and I do not need the
.value
as computed vars are unwrapped. E.g.Expected behavior
I expected the types to be the same as before and to unwrap the getters. Am I missing a new type/interface?
Actual behavior
Although I access the computed getter references without
.value
- the type hinting expects me to use.value
which would actually result in a bug.Additional information
Hopefully it's a simple change which I've missed but I was looking a while and can't seem to see the solution yet.
Also, the type behaviour is the same if I remove the return type from the
useStore
method.Beta Was this translation helpful? Give feedback.
All reactions