Denis Bookreev
Denis Bookreev

Reputation: 31

RefSymbol of Pinia store

When I use Pinia in my Nuxt3 project:

const {isSomeFlag} = storeToRefs(someStore);

I see this type of isSomeFlag

isSomeFlag: Ref<{
    value: boolean
    [RefSymbol]: true
}>

instead

isSomeFlag: Ref<boolean>

Same problem is with arrays and objects and I have TS errors when I unref these Refs. But code is working correctly - only TS errors.

How to fix it?

"vue": "3.4.15", "nuxt": "3.8.1", "@pinia/nuxt": "^0.5.1", "pinia": "^2.1.7",

I have tried to use properties of store directly

const isSomeFlag = someStore.isSomeFlag;

and it has type:

isSomeFlag: {
    value: boolean;
    [RefSymbol]: true;
}

But it is not reactive

I have tested storeToRefs on clear project (Vue3 + Pinia): it is correct Ref type enter image description here

Upvotes: 0

Views: 91

Answers (1)

Denis Bookreev
Denis Bookreev

Reputation: 31

It was vue-demi package

I have removed this from tsconfig and incorrect types went away.

Upvotes: 0

Related Questions