Should Pinia warn when a mapState property is initially not present? #641
-
Quick scenario: Vue 2 with Options API, Typescript, Pinia 0.5.4 Assume I have a state defined as
and define my store as
and finally, I in my options API I use mapState() like so...
As far as I can tell, when the Even once Since it's easy to miss explicitly setting undefined values in classes (at least, it was for me!) is it possible/worthwhile for Pinia to warn during the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The problem here is that the return value of state should be a plain object, like |
Beta Was this translation helpful? Give feedback.
The problem here is that the return value of state should be a plain object, like
data
. Probably worth adding to the API docs. Maybe we could add a warning if the return isn't a plain object. There is already a function for it (I think it should work) in the code base !