Skip to content

fix(nextjs): re-declare captureRouterTransitionStart in index.types#21452

Open
tsushanth wants to merge 1 commit into
getsentry:developfrom
tsushanth:feat/nextjs-types-router-transition
Open

fix(nextjs): re-declare captureRouterTransitionStart in index.types#21452
tsushanth wants to merge 1 commit into
getsentry:developfrom
tsushanth:feat/nextjs-types-router-transition

Conversation

@tsushanth

Copy link
Copy Markdown

Fixes #19939.

Summary

captureRouterTransitionStart is exported from ./client/index.ts and resolves correctly at runtime through the browser export condition (index.client.js). It's missing from the types condition entry point (index.types.d.ts), so static analysis tools that follow the types condition — oxlint, eslint-plugin-import's import/namespace rule, and tsc from a server-condition context — report "captureRouterTransitionStart" not found in imported namespace "@sentry/nextjs". The function still works at runtime; only the static-analysis surface is wrong.

Root cause

packages/nextjs/src/index.types.ts carries explicit export declare const X: typeof clientSdk.X redeclarations for every other client-only export that needs to be visible to the types condition (linkedErrorsIntegration, contextLinesIntegration, spanStreamingIntegration, withStreamedSpan, growthbookIntegration, launchDarklyIntegration, etc.). captureRouterTransitionStart was added to ./client/index.ts but not mirrored into index.types.ts, so it disappears from the published .d.ts even though it's part of the runtime client surface.

Fix

Add the missing redeclaration alongside the other client-only exports:

export declare const captureRouterTransitionStart: typeof clientSdk.captureRouterTransitionStart;

Trivially correct — same shape used for the surrounding declarations.

Note

I wasn't able to run yarn install / yarn build:dev locally to validate (disk space exhausted on my machine). CI should cover the build, types, and lint checks; happy to rebase or amend if anything surfaces.

Fixes getsentry#19939.

`captureRouterTransitionStart` is exported from `./client` but resolves to
the client SDK only — without an explicit redeclaration in `index.types`,
static analysis tools (oxlint, eslint-plugin-import) that follow the
`types` export condition can't find it in the `@sentry/nextjs` namespace,
even though the function is available at runtime in browser bundles.

This is the same shape used for other client-only exports a few lines
above (`linkedErrorsIntegration`, `contextLinesIntegration`,
`spanStreamingIntegration`, `withStreamedSpan`).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tsushanth tsushanth requested a review from a team as a code owner June 10, 2026 19:59
@tsushanth tsushanth requested review from nicohrubec and s1gr1d and removed request for a team June 10, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

captureRouterTransitionStart missing from index.types.d.ts — linters report 'not found in namespace'

1 participant