Typing a store wrapping a composable #2258
Unanswered
PaulHax
asked this question in
Help and Questions
Replies: 1 comment
-
The one you mentioned should be the one working: type AnnotationToolStore = ReturnType<typeof useAnnotationTool> |
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.
-
I've got a composable,
useAnnotationTool
, that is wrapped by 2 "children" stores,rulerTool
andrectangleTool
. The stores mostly re-expose the refs and functions implemented inuseAnnotationTool
.I'ed like to pass ether the
rulerTool
orrectangleTool
stores as a component property on aAnnotationTool
component. How do you create a Typescript type for "a store that wraps theuseAnnotationTool
"?This does not seem to work:
The code I'm working on:
useAnnotationTool: https://github.com/Kitware/VolView/blob/b4628956a90c967bd1756da4745b9131a743f58a/src/store/tools/useAnnotationTool.ts#L31
rectangles store:
https://github.com/Kitware/VolView/blob/b4628956a90c967bd1756da4745b9131a743f58a/src/store/tools/rectangles.ts#L20-L27
Maybe there is a better way to approach this sharing of logic across "sibling" stores? Instantiate a
annotationTool
store inside eachrectangles
andrulers
stores?Beta Was this translation helpful? Give feedback.
All reactions