Skip to content

Conversation

@aicest
Copy link

@aicest aicest commented Dec 20, 2025

Sorry for duplicating PR #1401, as the previous PR couldn't be reopened.
The entities library 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 onCaughtError type inference in RenderOptions.

Repro: https://codesandbox.io/p/sandbox/delicate-voice-7wnf7z?file=%2Ftest%2Frender.test-d.ts%3A6%2C5-6%2C28

Screenshot 2025-05-28 at 23 40 10

Why: As explained above.

How: Update TS types.

Checklist:

  • Documentation added to the
    docs site
  • Tests
    - React v18 types: No impact
    - React v19 types: Fixed
  • TypeScript definitions updated
  • Ready to be merged

Copilot AI review requested due to automatic review settings December 20, 2025 16:26
@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 20, 2025

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:

Sandbox Source
react-testing-library-examples Configuration

Copy link

Copilot AI left a 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 RenderOptions to check for optional onCaughtError? instead of required onCaughtError
  • Changed test file directive from @ts-expect-error to @ts-ignore to 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.

aicest and others added 2 commits December 21, 2025 00:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

1 participant