Skip to content
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

Add error using @react.componentWithProps with external #7217

Merged
merged 5 commits into from
Dec 30, 2024

Conversation

mununki
Copy link
Member

@mununki mununki commented Dec 24, 2024

Resolves #7215

@mununki mununki requested a review from cknitt December 24, 2024 08:53
| _, [_] ->
Jsx_common.raise_error ~loc:pstr_loc
"Components cannot be defined as externals when using \
@react.componentWithProps. Please use @react.component instead."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if the user intended to define a React component as a function of a props record, we should rather tell him to use the type React.component<props> in his external definition instead.

So maybe the message should be something like

Components cannot be defined as externals when using @react.componentWithProps.

If you intended to define an external for a React component using a props type,
use the type React.component<props> instead.
Alternatively, use @react.component for an external definition with labeled arguments.

@mununki mununki requested a review from cknitt December 30, 2024 04:12
@cknitt
Copy link
Member

cknitt commented Dec 30, 2024

Oh, CI failed, you still need to update the error message in the tests.

@mununki
Copy link
Member Author

mununki commented Dec 30, 2024

Oh, CI failed, you still need to update the error message in the tests.

Oh, I forgot it. Done 4e2d358

@cknitt cknitt merged commit 32fa620 into master Dec 30, 2024
20 checks passed
@cknitt cknitt deleted the error-react-component-with-props-external branch December 30, 2024 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add error for the use case @react.componentWithProps with external bindings
2 participants