Skip to content

Generic type for props for ReactElement is misleading #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
s-h-a-d-o-w opened this issue Apr 22, 2019 · 3 comments · Fixed by #162
Closed

Generic type for props for ReactElement is misleading #161

s-h-a-d-o-w opened this issue Apr 22, 2019 · 3 comments · Fixed by #162

Comments

@s-h-a-d-o-w
Copy link
Contributor

s-h-a-d-o-w commented Apr 22, 2019

I'm referring to this and mean that the <P> should be removed. That's it. :)

Reason being - it can't be used to ensure only elements with props of type P are assigned:

type Props = {
  bar: number
};
const MyComponent: React.FC<Props> = ({bar}) => (<div>{bar}</div>);
const element: React.ReactElement<Props> = <div />; // Works!
@piotrwitek
Copy link
Owner

@s-h-a-d-o-w I agree, let's fix it, accepting PR's.

@s-h-a-d-o-w
Copy link
Contributor Author

Encountered some workflow hickups (didn't realize the contributors thing is automated and the pre-push hook failed because I first tried running it on Windows) but the error that is thrown now does not seem related to my change.

@piotrwitek
Copy link
Owner

@s-h-a-d-o-w yes I updated TS and forgot to update some HOC issues that are bugs in the compiler, I will fix it in other PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants