-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: Update 'onCaughtError' type inference in 'RenderOptions' to work with React v19 #1438
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
fix: Update 'onCaughtError' type inference in 'RenderOptions' to work with React v19 #1438
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit a970da6:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes TypeScript type inference for the onCaughtError option in RenderOptions to properly support React 19. The fix addresses an issue where the conditional type check was too strict, requiring the property to be non-optional when React 19's RootOptions defines it as optional.
Key changes:
- Updated the conditional type in
RenderOptionsto check for optionalonCaughtError?instead of requiredonCaughtError - Changed test file directive from
@ts-expect-errorto@ts-ignoreto maintain compatibility with both React 18 and 19 type checking in CI
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| types/index.d.ts | Made onCaughtError property optional in the conditional type check to match React 19's optional property definition |
| types/test.tsx | Updated test comments and TypeScript directive to use @ts-ignore for cross-version compatibility during CI testing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
Hi @eps1lon, could pls help push this forward? Thank you. |
|
🎉 This PR is included in version 16.3.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sorry for duplicating PR #1401, as the previous PR couldn't be reopened.
The
entitieslibrary has released version v6.0.1 to correct its TS types, the PR changes should now pass type checks (#1401 (comment)).What: To fix incorrect
onCaughtErrortype inference inRenderOptions.Repro: https://codesandbox.io/p/sandbox/delicate-voice-7wnf7z?file=%2Ftest%2Frender.test-d.ts%3A6%2C5-6%2C28
Why: As explained above.
How: Update TS types.
Checklist:
docs site
- React v18 types: No impact
- React v19 types: Fixed