Plugin + TypeScript: How to type new state properties based on new option? #1411
Unanswered
ByScripts
asked this question in
Help and Questions
Replies: 1 comment
-
@ByScripts Check this discussion. The only way is explicit check against |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm trying to get custom prop typing based on custom option value.
Let's take this simple plugin:
It adds a custom prop to the state only if the
addCustomProp
is set to true.For now, I added these declarations:
It works, BUT the
customProp
state property is now proposed for ALL stores, even if theaddCustomProp
option was not passed (or passed asfalse
)Is there a way to add
customProp
typing toPiniaCustomStateProperties
based on theaddCustomProp
option value?Thank you.
Beta Was this translation helpful? Give feedback.
All reactions