The AnnotoriousContext
doesn't use the AnnotoriousContextState
type
#421
Labels
v3.x
Work on the next major release
Issue
The
AnnotoriousContext
is created using the auto-inferred type from the inline object:annotorious/packages/annotorious-react/src/Annotorious.tsx
Lines 26 to 36 in 9188ea1
However, there's the
AnnotoriousContextState
lying around unused:annotorious/packages/annotorious-react/src/Annotorious.tsx
Lines 14 to 24 in 9188ea1
That makes the props obtained from the
useContext(AnnotoriousContext)
have theany
type:Also, it allows unsafe accessing of possibly missing properties:
Suggested solution
The
Annotorious
may become a generic provider accepting the type for the specificAnnotator
sub-type, like theImageAnnotator
:annotorious/packages/annotorious/src/Annotorious.ts
Lines 20 to 36 in 9188ea1
The text was updated successfully, but these errors were encountered: