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
![image](https://private-user-images.githubusercontent.com/68850090/346972774-5174d810-78ac-43b2-b618-1e235b063363.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNzM5MTYsIm5iZiI6MTczOTE3MzYxNiwicGF0aCI6Ii82ODg1MDA5MC8zNDY5NzI3NzQtNTE3NGQ4MTAtNzhhYy00M2IyLWI2MTgtMWUyMzViMDYzMzYzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA3NDY1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTcxZDY5NDliMDhiMTViNmRjMWY2ZDU2NzljYzRjMTg0Nzg3MWY1YzI3MzQ5ZjJiNTE3NjQ4MDI3ZDI2NWZlNmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0._aT5q3khdAATsVURqaeQheGoMkKhBF4iwsXERqwHQIg)
![image](https://private-user-images.githubusercontent.com/68850090/346973182-d9cc76c6-22b6-4bd7-9a97-a9c7a5b4ca21.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNzM5MTYsIm5iZiI6MTczOTE3MzYxNiwicGF0aCI6Ii82ODg1MDA5MC8zNDY5NzMxODItZDljYzc2YzYtMjJiNi00YmQ3LTlhOTctYTljN2E1YjRjYTIxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA3NDY1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE3OTEyNWU1MzVjMjk5M2E2OWI1YTQzMjEwYzgxMjBhNmQ4ZmM2N2ZhM2UwZWZjYzg2NjkwN2M4ODI2NmEwNzQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.5yWkf8br0ncF5mZBaVAfezUqDMmNw-5XiS8qDtvFpBI)
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: