Skip to content

TS error when specifying store options #14

Answered by danvratil
danvratil asked this question in Q&A
Discussion options

You must be logged in to vote

OK, I think I figured it out while experimenting with the codesandbox.

My setup is slightly specific - I have a monorepo with several subprojects - one of them is a library that defines the store, another one is a Vue app that actually takes care of creating Pinia and instantiating the store. I had pinia-plugin-persistedstate-2 installed in both the library and the app, but I did not import it in the library, just in the app. Thus, the declare module "pinia" code from this plugin did not get included in the library code and TS wasn't aware of the plugin at all.

Adding

import { PluginOptions } from 'pinia-plugin-persistedstate-2'

to the file with the store definition (even if I don't actu…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by danvratil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants