Using mapState with array syntax will override/alter types of the component #1589
Replies: 2 comments
-
Additional information: Vue version is 2.7.10, |
Beta Was this translation helpful? Give feedback.
-
Using options API for both my components and my stores, Nuxt 3.3 For me, it seems that when using both I tried to reproduce on a different repository, without success. I'll post here again if I find a proof to this bug. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Reproduction
see below
Steps to reproduce the bug
test.store.ts
myview.vue
Even tough paraAdjusts and nextSerie are not even getting mapped, their types in myview.vue will get altered:
-paraAdjusts will get
Array<paraAdjust> & Array<string>
instead ofArray<paraAdjust>
-nextSerie will get
number
instead ofMyClass
This can only be avoided if you use the object synatx for mapState:
Expected behavior
Typescript types in components using mapState with array syntax should not be altered.
Actual behavior
Typescript types in components using mapState with array syntax are altered to the type defined in the used store.
Additional information
No response
Beta Was this translation helpful? Give feedback.
All reactions