Skip to content

fix(astro): expose types for @vercel/analytics/astro export (#169) - #219

Open
VG31OP wants to merge 1 commit into
vercel:mainfrom
VG31OP:fix/astro-export-types
Open

VG31OP wants to merge 1 commit into
vercel:mainfrom
VG31OP:fix/astro-export-types

Conversation

@VG31OP

@VG31OP VG31OP commented Oct 15, 2026

Copy link
Copy Markdown

Summary

Fixes #169.

When importing @vercel/analytics/astro, TypeScript fails to resolve module declarations under TypeScript 4.7+ / 5.x resolution modes (moduleResolution: "bundler", "node16", or "nodenext"):

Cannot find module '@vercel/analytics/astro' or its corresponding type declarations.

Root Cause

  1. In packages/web/package.json#exports["./astro"], only "import": "./dist/astro/component.ts" was provided, omitting the "types" export condition. TypeScript requires the "types" condition to be listed first for subpath imports.
  2. In packages/web/package.json#typesVersions["*"], entries existed for next, nuxt, react, remix, server, sveltekit, and vue, but "astro" was missing.
  3. Other subpath export conditions (./next, ./react, ./nuxt, ./remix, ./vue) were also missing explicit "types" conditions in exports, relying solely on fallback typesVersions.

Changes

  • Added "types": "./dist/astro/component.ts" to exports["./astro"].
  • Added "astro": ["dist/astro/component.ts"] to typesVersions["*"].
  • Added explicit "types" conditions across all subpath export targets in packages/web/package.json.

Verification

  • Tested with pnpm --filter astro build and astro check in apps/astro: @vercel/analytics/astro imports and resolves cleanly without type errors.
  • Verified all existing vitest tests in packages/web pass (10/10 test files, 107/107 tests passing).
  • Verified Biome checks pass with zero errors.

@vercel

vercel Bot commented Oct 15, 2026

Copy link
Copy Markdown

@VG31OP is attempting to deploy a commit to the Curated Tests - Permanent E2E Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

Type error import Analytics from '@vercel/analytics/astro';

1 participant