I'm getting a weird error in the following code: Property 'length' does not exist on type '{ [RefSymbol]: true; }'.
But when I check the type of foo
in the getCount function my IDE tels me its of type Foo[]
. What am I doing wrong?
import { defineStore } from 'pinia';
import { useStorage } from '@vueuse/core';
interface Foo {}
export const useFooStore = defineStore('foo', {
state: () => ({
foo: useStorage('foo', [] as Foo[]),
}),
actions: {
getCount() {
return this.foo.length; //Here's the error
},
},
});
Job
). Can you create a minimal example that demonstrates the problem> – Sikorski