How to avoid explicit return types for getters in Pinia with TypeScript?
I’m using Pinia for state management in my Vue.js project with TypeScript, and I want to simplify the return type definitions for my getters. Here’s a basic example of what I have:
How to correctly implement typing for a generic pinia store in a composable?
Context VueJs 3.4.19 Typescript 5.3.3 Pinia 2.1.6 In many views of my application, I need to fetch data from an API call. So each view have an onMounted() hook wich looks like: // Users.vue import { useUserStore } from ‘@/store/userStore’; const userStore = useUserStore(); onMounted(async() => { try { await userStore.fetchUsers(); } catch (err) { […]