Enhance user experience when using the composition API's way of defining a store #1617
Closed
yannick-milanetto
started this conversation in
Ideas
Replies: 1 comment
-
This has one major issue: TypeScript. If things are returned implicitly, it won't be possible for TypeScript to check the store usage anymore. |
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.
-
What problem is this solving
As per doc https://pinia.vuejs.org/core-concepts/#setup-stores , we have a way to define our pinia stores using a syntax similar to Vue composition API.
I was wondering if it would be possible, as Vue managed in a way to do with
defineProps
or<script setup>
, to return automatically all the properties and methods of our store, without having to do it explicitely with a return object(
return { count, name, doubleCount, increment }
in the doc )It would provide a better user experience by removing some boilerplate which i found useless in this case.
If deciding which actions and properties are exposed is important (personally i don't use it), we could still imagine that you can restrict them by returning an explicit object, but the default behaviour would be to make everything exposed.
Proposed solution
Describe alternatives you've considered
No response
Beta Was this translation helpful? Give feedback.
All reactions