No way to describe a JSX intrinsic which accepts props of a given type
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Thanks to `$JSXIntrinsics`, Flow knows the type of the props of each intrinsic. However, there appears to be no way to describe a JSX intrinsic which accepts props of a given type. That is, today I have to write:
```jsx
const SideBySide = (
First: React.ElementType,
Second: React.ElementType,
props: {}
) =>
```
which does not validate that `First` and `Second` take the given props. It would be better to be able to write:
```jsx
const SideBySide = (
First: React.ElementType
,
Second: React.ElementType
,
props: P
) =>
```
You *can* say:
```jsx
const SideBySide = (
First: React.ComponentType
,
Second: React.ComponentType
,
props: P
) =>
```
but this limits `First` and `Second` to being composite component types, when there's no (application) reason not to allow them to be intrinsic types.
It's possible that there's some kind of type wizardry which can implement what I'm describing, but I haven't been able to come up with it.
Contributor guide
Assessment
This issue has not been assessed yet.