storeToRefs with undefined type not always a Ref #1349
-
ReproductionSteps to reproduce the bugCreate a pinia store with a state property that can be undefined and use storeToRefs to turn it into a ref. Expected behaviorBoth types should be a Ref. Actual behaviorThe optional one has type "undefined", but only the Ref's type should be string | undefined. it is: Additional informationThis makes it more complicated to work with such refs, as |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
try it |
Beta Was this translation helpful? Give feedback.
-
Cool. That's working, thanks! I also had another problem with optional parameters: When you don't define it explicitly as undefined, storeToRefs doesn't work. |
Beta Was this translation helpful? Give feedback.
try it
optional: string | undefined