Skip to content

fix(react-native-tracker): emit .d.ts with .js extensions for nodenext#1478

Merged
Matus Tomlein (matus-tomlein) merged 3 commits into
release/4.8.2from
fix/react-native-dts-extensions-nodenext
Jun 17, 2026
Merged

fix(react-native-tracker): emit .d.ts with .js extensions for nodenext#1478
Matus Tomlein (matus-tomlein) merged 3 commits into
release/4.8.2from
fix/react-native-dts-extensions-nodenext

Conversation

@matus-tomlein

Copy link
Copy Markdown
Contributor

Problem

A customer reported that @snowplow/react-native-tracker .d.ts declaration files do not include file extensions on internal import/export paths (e.g. export * from './types' instead of export * from './types.js'). This breaks type resolution for consumers using TypeScript's moduleResolution: 'nodenext' / 'node16'.

The ESM JS output was already correct (export * from "./types.js") — extensions are added by react-native-builder-bob's Babel pipeline — but the declaration files came straight from tsc with moduleResolution: node and were extensionless. Under nodenext, this surfaces as error TS2305: Module '...' has no exported member 'TrackerConfiguration' because the internal re-exports fail to resolve.

Fix

Upgrade react-native-builder-bob 0.30.30.42.1. bob 0.42.0 added .d.ts extension rewriting (callstack/react-native-builder-bob#945), including RN-aware handling of platform-specific declarations (.ios.d.ts / .android.d.ts) and .mts/.cts — edge cases a hand-rolled post-processing script would get wrong.

The bob 0.42 typescript target no longer accepts an esm option (it is inferred from the commonjs/module targets), so it is removed from the build config in package.json.

Verification

  • rushx build succeeds; emitted dist/typescript/module/src/*.d.ts (the ESM import-condition types) now carry .js extensions. The commonjs declarations remain extensionless, which is correct for the require condition.
  • ✅ Isolated nodenext consumer smoke test: extensionless declarations fail with TS2305; the new build resolves cleanly (tsc exit 0).
  • ✅ Full test suite passes (13 suites, 68 tests).

Notes

  • The lockfile diff is large because the 12-minor-version bob jump pulls in its modern dependency tree (newer @babel/core transitively). bob 0.42 bundles its own typescript@6 for declaration emission; the workspace continues to typecheck and test against its pinned typescript@~4.6.
  • Node ≥ 20.19 is required by bob 0.42 (engines); CI/local Node 22 satisfies this.

🤖 Generated with Claude Code

…odenext

Upgrade react-native-builder-bob from 0.30.3 to 0.42.1 so the emitted
TypeScript declaration files include explicit .js extensions on relative
import/export specifiers (e.g. export * from './types.js').

Previously the ESM .js output carried extensions (added by bob's Babel
pipeline) but the .d.ts files came straight from tsc and were
extensionless, breaking type resolution for consumers using TypeScript's
moduleResolution: 'nodenext' / 'node16'.

bob 0.42.0 added this rewriting via callstack/react-native-builder-bob#945,
including handling for React Native platform-specific declarations
(.ios.d.ts / .android.d.ts) and .mts/.cts. The bob 0.42 typescript target
no longer accepts an `esm` option (it is inferred from the commonjs/module
targets), so it is removed from the build config.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 12, 2026 11:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses TypeScript moduleResolution: "nodenext"/"node16" consumer breakage in @snowplow/react-native-tracker by ensuring emitted .d.ts files include .js extensions in internal re-exports/imports (matching the existing ESM JS output behavior).

Changes:

  • Upgrades react-native-builder-bob to a version that rewrites internal .d.ts paths to include .js extensions for NodeNext/Node16 resolution.
  • Updates the bob typescript target configuration by removing the no-longer-supported esm option.
  • Updates Rush repo state to reflect the lockfile change.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
trackers/react-native-tracker/package.json Bumps bob to ^0.42.1 and adjusts bob build target config for TypeScript declarations.
common/config/rush/repo-state.json Updates Rush shrinkwrap hash after dependency/lockfile changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 72 to 76
"@types/react": "^18.2.44",
"react-native": "0.74.5",
"node-fetch": "~3.3.2",
"react-native-builder-bob": "^0.30.3",
"react-native-builder-bob": "^0.42.1",
"react-native-get-random-values": "^1.11.0"
…s fix

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
react-native-builder-bob 0.42.1 and its transitive dependencies (e.g.
yargs-parser@22) require Node >= 20, which broke CI on Node 18. Node 18
is also EOL. Bump CI workflows and .nvmrc to Node 22 (active LTS) and
raise rush.json nodeSupportedVersionRange floor to 20.19.0 (bob's minimum).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@matus-tomlein Matus Tomlein (matus-tomlein) changed the base branch from master to release/4.8.2 June 17, 2026 10:01
@matus-tomlein Matus Tomlein (matus-tomlein) merged commit 64f44a4 into release/4.8.2 Jun 17, 2026
7 checks passed
Matus Tomlein (matus-tomlein) added a commit that referenced this pull request Jun 17, 2026
#1478)

* fix(react-native-tracker): emit .d.ts files with .js extensions for nodenext

Upgrade react-native-builder-bob from 0.30.3 to 0.42.1 so the emitted
TypeScript declaration files include explicit .js extensions on relative
import/export specifiers (e.g. export * from './types.js').

Previously the ESM .js output carried extensions (added by bob's Babel
pipeline) but the .d.ts files came straight from tsc and were
extensionless, breaking type resolution for consumers using TypeScript's
moduleResolution: 'nodenext' / 'node16'.

bob 0.42.0 added this rewriting via callstack/react-native-builder-bob#945,
including handling for React Native platform-specific declarations
(.ios.d.ts / .android.d.ts) and .mts/.cts. The bob 0.42 typescript target
no longer accepts an `esm` option (it is inferred from the commonjs/module
targets), so it is removed from the build config.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore(react-native-tracker): add rush change file for .d.ts extensions fix

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* ci: bump Node from 18 to 22

react-native-builder-bob 0.42.1 and its transitive dependencies (e.g.
yargs-parser@22) require Node >= 20, which broke CI on Node 18. Node 18
is also EOL. Bump CI workflows and .nvmrc to Node 22 (active LTS) and
raise rush.json nodeSupportedVersionRange floor to 20.19.0 (bob's minimum).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Matus Tomlein (matus-tomlein) added a commit that referenced this pull request Jun 17, 2026
#1478)

* fix(react-native-tracker): emit .d.ts files with .js extensions for nodenext

Upgrade react-native-builder-bob from 0.30.3 to 0.42.1 so the emitted
TypeScript declaration files include explicit .js extensions on relative
import/export specifiers (e.g. export * from './types.js').

Previously the ESM .js output carried extensions (added by bob's Babel
pipeline) but the .d.ts files came straight from tsc and were
extensionless, breaking type resolution for consumers using TypeScript's
moduleResolution: 'nodenext' / 'node16'.

bob 0.42.0 added this rewriting via callstack/react-native-builder-bob#945,
including handling for React Native platform-specific declarations
(.ios.d.ts / .android.d.ts) and .mts/.cts. The bob 0.42 typescript target
no longer accepts an `esm` option (it is inferred from the commonjs/module
targets), so it is removed from the build config.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore(react-native-tracker): add rush change file for .d.ts extensions fix

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* ci: bump Node from 18 to 22

react-native-builder-bob 0.42.1 and its transitive dependencies (e.g.
yargs-parser@22) require Node >= 20, which broke CI on Node 18. Node 18
is also EOL. Bump CI workflows and .nvmrc to Node 22 (active LTS) and
raise rush.json nodeSupportedVersionRange floor to 20.19.0 (bob's minimum).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants