Skip to content

fix(build): default to Node.js types, scope DOM types, @types/node -> 18.19.130#6280

Merged
pichlermarc merged 1 commit intoopen-telemetry:mainfrom
embrace-io:overbalance/default-to-node-types
Jan 16, 2026
Merged

fix(build): default to Node.js types, scope DOM types, @types/node -> 18.19.130#6280
pichlermarc merged 1 commit intoopen-telemetry:mainfrom
embrace-io:overbalance/default-to-node-types

Conversation

@overbalance
Copy link
Copy Markdown
Contributor

@overbalance overbalance commented Jan 12, 2026

Short description of changes

Removed dom and dom.iterable from root tsconfigs and explicitly added them only to packages that use DOM APIs.
Since tsconfigs are scoped to packages, any package that references DOM APIs needs dom types, even if the majority of that package's code targets Node.

Details

Inspired by the issue in #6278

  • Remove dom and dom.iterable from the base tsconfig, defaulting all packages to Node.js types
  • Update @types/node from 18.6.5 to 18.19.130 across all 41 packages (required for global performance type)
  • Add DOM types explicitly to browser/isomorphic packages via tsconfig lib option
  • Remove DOM types from API packages that don't need them
  • Fix type errors exposed by stricter Node.js types

@types/node upgrade (18.6.5 → 18.19.130)

The global performance object type was added in @types/node 18.11.0. Without this upgrade, removing DOM types breaks packages that use performance directly.

Type fixes for @types/node 18.19.x

@opentelemetry/otlp-exporter-base

  • Added override modifier to createConnection in test class extending http.Agent

@opentelemetry/instrumentation-http

  • Fixed OutgoingHttpHeaders | readonly string[] type narrowing in utils.ts and test files
  • In newer @types/node, request.headers can be a string array for raw headers

@opentelemetry/instrumentation-grpc

  • Made patchedCallback function generic to fix type inference issues with SendUnaryDataCallback

@opentelemetry/sdk-trace-base

  • Fixed TestExporterWithDelay callback to properly pass ExportResult through setTimeout

@opentelemetry/resources

  • Fixed setTimeout resolve callback to pass undefined explicitly in tests

@opentelemetry/core

  • Added explicit Performance type annotation to otperformance export in browser platform

API packages with DOM types removed

These packages don't use any DOM APIs, so DOM types are removed:

  • @opentelemetry/api
  • @opentelemetry/api-logs

Packages with DOM types added via tsconfig lib

These 17 packages need DOM types for browser APIs (fetch, XMLHttpRequest, navigator, VisibilityState, Performance, etc.):

Browser-only packages:

  • @opentelemetry/sdk-trace-web
  • @opentelemetry/context-zone-peer-dep
  • @opentelemetry/web-common
  • @opentelemetry/instrumentation-fetch
  • @opentelemetry/instrumentation-xml-http-request
  • @opentelemetry/opentelemetry-browser-detector

Isomorphic packages (browser + Node.js):

  • @opentelemetry/core
  • @opentelemetry/sdk-trace-base
  • @opentelemetry/sdk-logs
  • @opentelemetry/exporter-zipkin
  • @opentelemetry/otlp-exporter-base
  • @opentelemetry/exporter-trace-otlp-http
  • @opentelemetry/exporter-trace-otlp-proto
  • @opentelemetry/exporter-logs-otlp-http
  • @opentelemetry/exporter-logs-otlp-proto
  • @opentelemetry/exporter-metrics-otlp-http
  • @opentelemetry/exporter-metrics-otlp-proto

Test plan

  • npm run compile succeeds
  • Full test suite passes

@overbalance overbalance requested a review from a team as a code owner January 12, 2026 19:05
@overbalance overbalance marked this pull request as draft January 12, 2026 19:26
@overbalance overbalance changed the title fix(build): default to Node.js types, add DOM types only where needed fix(build): default to Node.js types, update @types/node to 18.19.130 Jan 12, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.41%. Comparing base (0a9b614) to head (620f276).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6280   +/-   ##
=======================================
  Coverage   95.41%   95.41%           
=======================================
  Files         317      317           
  Lines        9597     9597           
  Branches     2220     2220           
=======================================
  Hits         9157     9157           
  Misses        440      440           
Files with missing lines Coverage Δ
...ntelemetry-instrumentation-grpc/src/clientUtils.ts 96.73% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

overbalance added a commit to embrace-io/opentelemetry-js that referenced this pull request Jan 12, 2026
@overbalance overbalance marked this pull request as ready for review January 12, 2026 20:07
@overbalance overbalance added the browser Browser-specific additions or benefits label Jan 12, 2026
@overbalance overbalance force-pushed the overbalance/default-to-node-types branch from 4fde82a to 064220f Compare January 13, 2026 16:57
@overbalance overbalance requested review from a team as code owners January 14, 2026 18:35
Comment thread packages/opentelemetry-core/src/platform/node/index.ts Outdated
Comment thread experimental/packages/otlp-transformer/src/logs/json/logs.ts Outdated
@overbalance overbalance marked this pull request as draft January 15, 2026 16:30
@overbalance overbalance force-pushed the overbalance/default-to-node-types branch from ba6449e to 9570249 Compare January 15, 2026 18:47
@overbalance overbalance changed the title fix(build): default to Node.js types, update @types/node to 18.19.130 fix(build): default to Node.js types, scope DOM types, @types/node -> 18.19.130 Jan 15, 2026
@overbalance overbalance force-pushed the overbalance/default-to-node-types branch from 9570249 to 4120b3c Compare January 16, 2026 01:46
@overbalance overbalance force-pushed the overbalance/default-to-node-types branch from 4120b3c to 620f276 Compare January 16, 2026 01:48
@overbalance overbalance marked this pull request as ready for review January 16, 2026 02:25
@pichlermarc pichlermarc added this pull request to the merge queue Jan 16, 2026
Merged via the queue into open-telemetry:main with commit b85b41f Jan 16, 2026
27 checks passed
@overbalance overbalance deleted the overbalance/default-to-node-types branch January 16, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

browser Browser-specific additions or benefits

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants