jossmac / jossmac/react-images

ViewType caption typing is incorrect

Open
#367 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.3k
Forks
433
PR merge metrics
No merged PRs in 30d

Description

Because of how Captions are rendered by default, the typing of `caption` as `ReactNode` is incorrect. This includes object types like arrays and `React.Component` types. If you try passing one of these as the caption, however, it renders as `[Object object]` rather than rendering properly.

What it should be instead is `string | number | boolean | null | undefined` - the primitive types that react can render. I'll open a PR to fix.

It would be great if we got support in the future for fully dynamic captions using React Components, but for now this is a much quicker fix.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.