Skip to content

✨ add Context type to @datadog/js-core/assembly#4842

Open
thomas-lebeau wants to merge 3 commits into
mainfrom
worktree-js-core-assembly-context
Open

✨ add Context type to @datadog/js-core/assembly#4842
thomas-lebeau wants to merge 3 commits into
mainfrom
worktree-js-core-assembly-context

Conversation

@thomas-lebeau

Copy link
Copy Markdown
Collaborator

Motivation

Per the @datadog/js-core RFC, the Context type used for event/context payload typing (consumed by electron-sdk and openfeature-js-client) was still marked as TODO under @datadog/js-core/assembly.

Changes

  • Ports Context, ContextValue, ContextArray from packages/browser-core/src/tools/serialisation/context.ts into packages/js-core/src/assembly/context.ts, re-exported from the @datadog/js-core/assembly entry.
  • Updates the API Extractor golden file (api/assembly.api.md) accordingly.

This is a pure additive change (new exports only), no existing behavior changes.

Test instructions

  • yarn workspace @datadog/js-core build && yarn api:check passes.
  • yarn typecheck passes.
  • yarn test:unit --spec packages/js-core/src/assembly/hook.spec.ts passes (no behavior change, existing suite still green).

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change. (N/A — pure type-only addition, matches convention of other type-only files with no dedicated spec)
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

Ports the Context/ContextValue/ContextArray types from browser-core's
tools/serialisation/context.ts, closing the TODO in the js-core RFC
for event/context payload typing used by electron-sdk and
openfeature-js-client.
@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 172.76 KiB 172.76 KiB 0 B 0.00%
Rum Profiler 8.22 KiB 8.22 KiB 0 B 0.00%
Rum Recorder 21.14 KiB 21.14 KiB 0 B 0.00%
Logs 55.44 KiB 55.44 KiB 0 B 0.00%
Rum Slim 130.87 KiB 130.87 KiB 0 B 0.00%
Worker 22.96 KiB 22.96 KiB 0 B 0.00%

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jul 3, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

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

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

'export type * from' is only supported starting TypeScript 4.5;
js-core targets TS 4.1.6 as its minimum supported version. Switch to
named type exports, which are supported since TS 3.8.
Now that Context/ContextValue/ContextArray live in
@datadog/js-core/assembly, delete the duplicated
browser-core/tools/serialisation/context.ts and point every internal
consumer, plus browser-core's own public re-export in index.ts, at the
js-core version instead.

Downstream packages (browser-rum-core, browser-logs, browser-rum, ...)
are unaffected: they still import Context from '@datadog/browser-core',
which now just re-exports the js-core type under the hood.

No behavior change: Context is a pure type, identical in both places.
@thomas-lebeau thomas-lebeau marked this pull request as ready for review July 8, 2026 07:04
@thomas-lebeau thomas-lebeau requested a review from a team as a code owner July 8, 2026 07:04
@sbarrio sbarrio requested a review from bdibon July 9, 2026 07:05
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.

2 participants