From b6daf3605ebf8fb40b88a043b758bf157b6f264f Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 8 Jul 2026 10:59:03 +0200 Subject: [PATCH] feat(core): Make `attributes` required on serialized streamed spans `SerializedStreamedSpan.attributes` was typed as optional, but a serialized streamed span always carries an `attributes` object: `streamedSpanJsonToSerializedSpan` always sets `attributes: serializeAttributes(...)`, and `serializeAttributes` always returns an object (never `undefined`). Making the field required lets consumers read `span.attributes[...]` directly without redundant optional chaining or non-null assertions. Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/core/src/types/span.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/types/span.ts b/packages/core/src/types/span.ts index 1e44809a8fa0..7a7cddba62fa 100644 --- a/packages/core/src/types/span.ts +++ b/packages/core/src/types/span.ts @@ -61,7 +61,7 @@ export interface StreamedSpanJSON { * Main difference: Attributes are converted to {@link Attributes}, thus including the `type` annotation. */ export type SerializedStreamedSpan = Omit & { - attributes?: Attributes; + attributes: Attributes; links?: SpanLinkJSON[]; };