Skip to content

🐛 Use unknown type for addReactError error parameter#4863

Merged
mormubis merged 2 commits into
mainfrom
mormubis/fix-add-react-error-unknown-type
Jul 10, 2026
Merged

🐛 Use unknown type for addReactError error parameter#4863
mormubis merged 2 commits into
mainfrom
mormubis/fix-add-react-error-unknown-type

Conversation

@mormubis

Copy link
Copy Markdown
Contributor

Motivation

addError already accepts error: unknownaddReactError should match. React 19's onUncaughtError callback types the error as unknown (anything can be thrown in JS), so calling addReactError directly from it produces a type error today.

Fixes #4858.

Changes

Widens the error parameter in addReactError from Error to unknown, aligning it with the existing addError signature. The implementation is unchanged — the cast (error as Error & { dd_context?: Context }) already handles narrowing when accessing error properties.

Test instructions

  1. Run yarn test:unit --spec packages/browser-rum-react/src/domain/error/addReactError.spec.ts.
  2. All 2 tests should pass.

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jul 10, 2026

Copy link
Copy Markdown

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 1 Pipeline job failed

DataDog/browser-sdk | e2e: [chromium]   View in Datadog   GitLab

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 77.25% (+0.00%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 77ace2e | Docs | Datadog PR Page | Give us feedback!

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jul 10, 2026

Copy link
Copy Markdown

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 178.22 KiB 178.22 KiB 0 B 0.00%
Rum Profiler 8.22 KiB 8.22 KiB 0 B 0.00%
Rum Recorder 21.12 KiB 21.12 KiB 0 B 0.00%
Logs 55.53 KiB 55.53 KiB 0 B 0.00%
Rum Slim 136.28 KiB 136.28 KiB 0 B 0.00%
Worker 22.96 KiB 22.96 KiB 0 B 0.00%

@mormubis mormubis force-pushed the mormubis/fix-add-react-error-unknown-type branch 2 times, most recently from 891a2fd to 7eaf6b3 Compare July 10, 2026 09:47
@mormubis mormubis marked this pull request as ready for review July 10, 2026 12:05
@mormubis mormubis requested a review from a team as a code owner July 10, 2026 12:05

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7eaf6b36f5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/browser-rum-react/src/domain/error/addReactError.ts
@mormubis mormubis force-pushed the mormubis/fix-add-react-error-unknown-type branch from c20cdc5 to 77ace2e Compare July 10, 2026 12:15
@mormubis mormubis merged commit 2bacdcf into main Jul 10, 2026
31 checks passed
@mormubis mormubis deleted the mormubis/fix-add-react-error-unknown-type branch July 10, 2026 12:55
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 React 19 error handling types

4 participants