✨ add Context type to @datadog/js-core/assembly#4842
Open
thomas-lebeau wants to merge 3 commits into
Open
Conversation
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.
Bundles Sizes Evolution
|
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 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.
gogusarov
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Per the
@datadog/js-coreRFC, theContexttype used for event/context payload typing (consumed byelectron-sdkandopenfeature-js-client) was still marked as TODO under@datadog/js-core/assembly.Changes
Context,ContextValue,ContextArrayfrompackages/browser-core/src/tools/serialisation/context.tsintopackages/js-core/src/assembly/context.ts, re-exported from the@datadog/js-core/assemblyentry.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:checkpasses.yarn typecheckpasses.yarn test:unit --spec packages/js-core/src/assembly/hook.spec.tspasses (no behavior change, existing suite still green).Checklist