Skip to content

fix(astro): resolve middleware export types#21414

Open
itosa-kazu wants to merge 1 commit into
getsentry:developfrom
itosa-kazu:codex/fix-astro-middleware-types
Open

fix(astro): resolve middleware export types#21414
itosa-kazu wants to merge 1 commit into
getsentry:developfrom
itosa-kazu:codex/fix-astro-middleware-types

Conversation

@itosa-kazu

Copy link
Copy Markdown

Fixes #21413.

Summary

  • Point the @sentry/astro/middleware export types condition at the emitted index.d.ts declaration file.
  • Avoid exposing the Astro-version-specific MiddlewareResponseHandler alias from the middleware subpath declaration, so the published declaration remains readable for supported Astro versions where that alias is absent.
  • Preserve the existing runtime behavior by continuing to delegate to handleRequest().

Validation

  • git diff --check
  • JSON assertion that exports[./middleware].types is ./build/types/integration/middleware/index.d.ts
  • Temporary consumer project with @sentry/astro@10.57.0, astro@5.16.6, and typescript@5.9.3: original package reproduces TS7016; patched package metadata plus the expected declaration shape passes npx tsc --noEmit; runtime import still exports onRequest.

A direct package type-check in this sparse checkout was not runnable because the checkout/install did not include linked Sentry workspace packages such as @sentry/core, @sentry/browser, and @sentry/node.

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.

@sentry/astro/middleware types export points to missing declaration file

1 participant