Skip to content

Conversation

@aicest
Copy link
Contributor

@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
Contributor

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>
@aicest
Copy link
Contributor Author

aicest commented Jan 19, 2026

Hi @eps1lon, could pls help push this forward? Thank you.

@eps1lon eps1lon merged commit f32bd1b into testing-library:main Jan 19, 2026
9 checks passed
@github-actions
Copy link

🎉 This PR is included in version 16.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@aicest aicest deleted the pr/react-19-types-on-caught-error branch January 20, 2026 07:02
736-c41-2c1-e464fc974 pushed a commit to Swiss-Armed-Forces/Loom that referenced this pull request Jan 25, 2026
This MR contains the following updates:

| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [@testing-library/react](https://github.com/testing-library/react-testing-library) | devDependencies | patch | [`16.3.1` → `16.3.2`](https://renovatebot.com/diffs/npm/@testing-library%2freact/16.3.1/16.3.2) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/testing-library/react-testing-library/badge)](https://securityscorecards.dev/viewer/?uri=github.com/testing-library/react-testing-library) |
| [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react)) | devDependencies | patch | [`19.2.8` → `19.2.9`](https://renovatebot.com/diffs/npm/@types%2freact/19.2.8/19.2.9) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/DefinitelyTyped/DefinitelyTyped/badge)](https://securityscorecards.dev/viewer/?uri=github.com/DefinitelyTyped/DefinitelyTyped) |
| [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin)) | devDependencies | patch | [`8.53.0` → `8.53.1`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/8.53.0/8.53.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [@typescript-eslint/parser](https://typescript-eslint.io/packages/parser) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser)) | devDependencies | patch | [`8.53.0` → `8.53.1`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/8.53.0/8.53.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [ace-builds](https://github.com/ajaxorg/ace-builds) | dependencies | patch | [`1.43.5` → `1.43.6`](https://renovatebot.com/diffs/npm/ace-builds/1.43.5/1.43.6) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ajaxorg/ace-builds/badge)](https://securityscorecards.dev/viewer/?uri=github.com/ajaxorg/ace-builds) |
| [prettier](https://prettier.io) ([source](https://github.com/prettier/prettier)) | devDependencies | patch | [`3.8.0` → `3.8.1`](https://renovatebot.com/diffs/npm/prettier/3.8.0/3.8.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/prettier/prettier/badge)](https://securityscorecards.dev/viewer/?uri=github.com/prettier/prettier) |
| [typescript-eslint](https://typescript-eslint.io/packages/typescript-eslint) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint)) | devDependencies | patch | [`8.53.0` → `8.53.1`](https://renovatebot.com/diffs/npm/typescript-eslint/8.53.0/8.53.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |

---

### Release Notes

<details>
<summary>testing-library/react-testing-library (@&#8203;testing-library/react)</summary>

### [`v16.3.2`](https://github.com/testing-library/react-testing-library/releases/tag/v16.3.2)

[Compare Source](testing-library/react-testing-library@v16.3.1...v16.3.2)

##### Bug Fixes

- Update 'onCaughtError' type inference in 'RenderOptions' to work with React v19 ([#&#8203;1438](testing-library/react-testing-library#1438)) ([f32bd1b](testing-library/react-testing-library@f32bd1b))

</details>

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>

### [`v8.53.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8531-2026-01-19)

[Compare Source](typescript-eslint/typescript-eslint@v8.53.0...v8.53.1)

##### 🩹 Fixes

- **utils:** make RuleCreator root defaultOptions optional ([#&#8203;11956](typescript-eslint/typescript-eslint#11956))
- **eslint-plugin:** \[consistent-indexed-object-style] skip fixer if interface is a default export ([#&#8203;11951](typescript-eslint/typescript-eslint#11951))

##### ❤️ Thank You

- Cameron
- Yukihiro Hasegawa [@&#8203;y-hsgw](https://github.com/y-hsgw)

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.

</details>

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>

### [`v8.53.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#8531-2026-01-19)

[Compare Source](typescript-eslint/typescript-eslint@v8.53.0...v8.53.1)

This was a version bump only for parser to align it with other projects, there were no code changes.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.

</details>

<details>
<summary>ajaxorg/ace-builds (ace-builds)</summary>

### [`v1.43.6`](https://github.com/ajaxorg/ace-builds/blob/HEAD/CHANGELOG.md#1436-2026-01-23)

[Compare Source](ajaxorg/ace-builds@v1.43.5...v1.43.6)

</details>

<details>
<summary>prettier/prettier (prettier)</summary>

### [`v3.8.1`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#381)

[Compare Source](prettier/prettier@3.8.0...3.8.1)

[diff](prettier/prettier@3.8.0...3.8.1)

##### Include available `printers` in plugin type declarations ([#&#8203;18706](prettier/prettier#18706) by [@&#8203;porada](https://github.com/porada))

<!-- prettier-ignore -->

```ts
// Input
import * as prettierPluginEstree from "prettier/plugins/estree";

// Prettier 3.8.0
// Property 'printers' does not exist on type 'typeof import("prettier/plugins/estree")'. ts(2339)
prettierPluginEstree.printers.estree; //=> any

// Prettier 3.8.1
prettierPluginEstree.printers.estree; //=> Printer
prettierPluginEstree.printers["estree-json"]; //=> Printer
```

</details>

<details>
<summary>typescript-eslint/typescript-eslint (typescript-eslint)</summary>

### [`v8.53.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/typescript-eslint/CHANGELOG.md#8531-2026-01-19)

[Compare Source](typescript-eslint/typescript-eslint@v8.53.0...v8.53.1)

This was a version bump only for typescript-eslint to align it with other projects, there were no code changes.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.

</details>

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi45Mi40IiwidXBkYXRlZEluVmVyIjoiNDIuOTIuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicmVub3ZhdGUiXX0=-->

See merge request swiss-armed-forces/cyber-command/cea/loom!262

Co-authored-by: Loom MR Pipeline Trigger <group_103951964_bot_9504bb8dead6d4e406ad817a607f24be@noreply.gitlab.com>
736-c41-2c1-e464fc974 added a commit to Swiss-Armed-Forces/Loom that referenced this pull request Jan 25, 2026
chore(deps): update frontend dependencies (patch) (patch)

This MR contains the following updates:

| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [@testing-library/react](https://github.com/testing-library/react-testing-library) | devDependencies | patch | [`16.3.1` → `16.3.2`](https://renovatebot.com/diffs/npm/@testing-library%2freact/16.3.1/16.3.2) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/testing-library/react-testing-library/badge)](https://securityscorecards.dev/viewer/?uri=github.com/testing-library/react-testing-library) |
| [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react)) | devDependencies | patch | [`19.2.8` → `19.2.9`](https://renovatebot.com/diffs/npm/@types%2freact/19.2.8/19.2.9) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/DefinitelyTyped/DefinitelyTyped/badge)](https://securityscorecards.dev/viewer/?uri=github.com/DefinitelyTyped/DefinitelyTyped) |
| [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin)) | devDependencies | patch | [`8.53.0` → `8.53.1`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/8.53.0/8.53.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [@typescript-eslint/parser](https://typescript-eslint.io/packages/parser) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser)) | devDependencies | patch | [`8.53.0` → `8.53.1`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/8.53.0/8.53.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [ace-builds](https://github.com/ajaxorg/ace-builds) | dependencies | patch | [`1.43.5` → `1.43.6`](https://renovatebot.com/diffs/npm/ace-builds/1.43.5/1.43.6) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ajaxorg/ace-builds/badge)](https://securityscorecards.dev/viewer/?uri=github.com/ajaxorg/ace-builds) |
| [prettier](https://prettier.io) ([source](https://github.com/prettier/prettier)) | devDependencies | patch | [`3.8.0` → `3.8.1`](https://renovatebot.com/diffs/npm/prettier/3.8.0/3.8.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/prettier/prettier/badge)](https://securityscorecards.dev/viewer/?uri=github.com/prettier/prettier) |
| [typescript-eslint](https://typescript-eslint.io/packages/typescript-eslint) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint)) | devDependencies | patch | [`8.53.0` → `8.53.1`](https://renovatebot.com/diffs/npm/typescript-eslint/8.53.0/8.53.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |

---

### Release Notes

<details>
<summary>testing-library/react-testing-library (@&#8203;testing-library/react)</summary>

### [`v16.3.2`](https://github.com/testing-library/react-testing-library/releases/tag/v16.3.2)

[Compare Source](testing-library/react-testing-library@v16.3.1...v16.3.2)

##### Bug Fixes

- Update 'onCaughtError' type inference in 'RenderOptions' to work with React v19 ([#&#8203;1438](testing-library/react-testing-library#1438)) ([f32bd1b](testing-library/react-testing-library@f32bd1b))

</details>

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>

### [`v8.53.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8531-2026-01-19)

[Compare Source](typescript-eslint/typescript-eslint@v8.53.0...v8.53.1)

##### 🩹 Fixes

- **utils:** make RuleCreator root defaultOptions optional ([#&#8203;11956](typescript-eslint/typescript-eslint#11956))
- **eslint-plugin:** \[consistent-indexed-object-style] skip fixer if interface is a default export ([#&#8203;11951](typescript-eslint/typescript-eslint#11951))

##### ❤️ Thank You

- Cameron
- Yukihiro Hasegawa [@&#8203;y-hsgw](https://github.com/y-hsgw)

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.

</details>

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>

### [`v8.53.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#8531-2026-01-19)

[Compare Source](typescript-eslint/typescript-eslint@v8.53.0...v8.53.1)

This was a version bump only for parser to align it with other projects, there were no code changes.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.

</details>

<details>
<summary>ajaxorg/ace-builds (ace-builds)</summary>

### [`v1.43.6`](https://github.com/ajaxorg/ace-builds/blob/HEAD/CHANGELOG.md#1436-2026-01-23)

[Compare Source](ajaxorg/ace-builds@v1.43.5...v1.43.6)

</details>

<details>
<summary>prettier/prettier (prettier)</summary>

### [`v3.8.1`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#381)

[Compare Source](prettier/prettier@3.8.0...3.8.1)

[diff](prettier/prettier@3.8.0...3.8.1)

##### Include available `printers` in plugin type declarations ([#&#8203;18706](prettier/prettier#18706) by [@&#8203;porada](https://github.com/porada))

<!-- prettier-ignore -->

```ts
// Input
import * as prettierPluginEstree from "prettier/plugins/estree";

// Prettier 3.8.0
// Property 'printers' does not exist on type 'typeof import("prettier/plugins/estree")'. ts(2339)
prettierPluginEstree.printers.estree; //=> any

// Prettier 3.8.1
prettierPluginEstree.printers.estree; //=> Printer
prettierPluginEstree.printers["estree-json"]; //=> Printer
```

</details>

<details>
<summary>typescript-eslint/typescript-eslint (typescript-eslint)</summary>

### [`v8.53.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/typescript-eslint/CHANGELOG.md#8531-2026-01-19)

[Compare Source](typescript-eslint/typescript-eslint@v8.53.0...v8.53.1)

This was a version bump only for typescript-eslint to align it with other projects, there were no code changes.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.

</details>

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi45Mi40IiwidXBkYXRlZEluVmVyIjoiNDIuOTIuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicmVub3ZhdGUiXX0=-->

See merge request swiss-armed-forces/cyber-command/cea/loom!262

Co-authored-by: Loom MR Pipeline Trigger <group_103951964_bot_9504bb8dead6d4e406ad817a607f24be@noreply.gitlab.com>
Co-authored-by: open-source Pipeline <group_90701827_bot_ed04ae348bc5f40af9966fb8b6867e99@noreply.gitlab.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants