fix(types): import opentracing from the consumer's installed package - #8525
Conversation
Overall package sizeSelf size: 5.83 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.1 | 82.56 kB | 817.39 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
|
c0959cf to
2e0edc5
Compare
BenchmarksBenchmark execution time: 2026-05-19 13:43:12 Comparing candidate commit d6edf39 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 1498 metrics, 95 unstable metrics. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2e0edc540c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
`opentracing.initGlobalTracer(tracer)` fails to type-check because dd-trace's public types reach into `./vendor/dist/opentracing` while consumers reach into their own `node_modules/opentracing`. `Reference` / `Tracer` / `Span` declare `protected` members, so the two copies are nominally distinct classes and the dd-trace `Tracer` is not a subtype of the consumer's `opentracing.Tracer`. `index.d.ts` imports from `"opentracing"` directly and the package becomes a regular runtime dependency. npm, yarn, and pnpm hoist a single copy that both dd-trace and the consumer resolve to, and TypeScript dedupes the nominal class identity by `name@version` Package ID, so `initGlobalTracer(tracer)` accepts dd-trace's `Tracer`. The range is `>=0.14.0` rather than `>=0.14.7` to widen the hoist window for consumers pinned to an older patch — the repository was archived on 2023-05-23 and the type surface is identical across 0.14.0–0.14.7. The vendored type copy and its rspack build step are dropped; dd-trace's runtime never required the package. Fixes: #8523 Refs: #6958
2e0edc5 to
fc23ba0
Compare
Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>
…8525) `opentracing.initGlobalTracer(tracer)` fails to type-check because dd-trace's public types reach into `./vendor/dist/opentracing` while consumers reach into their own `node_modules/opentracing`. `Reference` / `Tracer` / `Span` declare `protected` members, so the two copies are nominally distinct classes and the dd-trace `Tracer` is not a subtype of the consumer's `opentracing.Tracer`. `index.d.ts` imports from `"opentracing"` directly and the package becomes a regular runtime dependency. npm, yarn, and pnpm hoist a single copy that both dd-trace and the consumer resolve to, and TypeScript dedupes the nominal class identity by `name@version` Package ID, so `initGlobalTracer(tracer)` accepts dd-trace's `Tracer`. The vendored type copy and its rspack build step are dropped; dd-trace's runtime never required the package. Fixes: #8523 Refs: #6958
…8525) `opentracing.initGlobalTracer(tracer)` fails to type-check because dd-trace's public types reach into `./vendor/dist/opentracing` while consumers reach into their own `node_modules/opentracing`. `Reference` / `Tracer` / `Span` declare `protected` members, so the two copies are nominally distinct classes and the dd-trace `Tracer` is not a subtype of the consumer's `opentracing.Tracer`. `index.d.ts` imports from `"opentracing"` directly and the package becomes a regular runtime dependency. npm, yarn, and pnpm hoist a single copy that both dd-trace and the consumer resolve to, and TypeScript dedupes the nominal class identity by `name@version` Package ID, so `initGlobalTracer(tracer)` accepts dd-trace's `Tracer`. The vendored type copy and its rspack build step are dropped; dd-trace's runtime never required the package. Fixes: #8523 Refs: #6958
Summary
opentracing.initGlobalTracer(tracer)fails to type-check because dd-trace's public types reach into./vendor/dist/opentracingwhile consumers reach into their ownnode_modules/opentracing. opentracing'sReference/Tracer/Spandeclareprotectedmembers, so the two copies are nominally distinct classes and the dd-traceTraceris not a subtype of the consumer'sopentracing.Tracer.index.d.tsimports from"opentracing"directly and the package becomes a regular runtime dependency. npm, yarn, and pnpm hoist a single copy that both dd-trace and the consumer resolve to, and TypeScript dedupes the nominal class identity byname@versionPackage ID, soinitGlobalTracer(tracer)accepts dd-trace'sTracer. The range is>=0.14.0rather than>=0.14.7to widen the hoist window for consumers pinned to an older patch — the repository was archived on 2023-05-23 and the type surface is identical across 0.14.0–0.14.7.The vendored type copy and its rspack build step are dropped; dd-trace's runtime never required the package.
Test plan
cd docs && yarn test—tsc -p .against the user-facingimport 'opentracing'is the regression assertion; fails on master, passes here.mocha packages/dd-trace/test/scope.spec.js packages/dd-trace/test/opentracing/**/*.spec.js— 228 passing / 2 pending (pre-existing).yarn lint— green (license check, eslint, docker checks).bun add file:dd-trace.tgz --linker=hoisted) hoists a singleopentracingnext todd-trace;tsc --target ES6 ... noop.tscompiles cleanly without a consumer-levelopentracinginstall — confirms the dep auto-installs and resolves at the consumer's tree.peerDependenciesMeta.optional: trueand no top-levelopentracinginstall,tscfails withTS2307: Cannot find module 'opentracing'on the consumer'sindex.d.tsresolution — confirming the bot's pushback and motivating the move to a regular dep.Fixes: #8523
Refs: #6958