After setting up a pinia store using the setup store
syntax as described in the documentation at , I encountered an issue while working with typescript and setup stores instead of option stores for my project.
The problem arises with type annotations for state variables:
export const useComponentsStore = defineStore('components', () => {
..
const selectedComponents: ServerConfigComponent[] = ref([]);
..
This results in the following error message:
Type 'Ref<never[]>' is missing the following properties from type 'ServerConfigComponent[]': length, pop, push, concat, and 35 more.ts(2740)
Interestingly, this issue does not occur with computed (getters) variables.