vercel / speed-insights

Vercel Speed Insights package
https://vercel.com/docs/speed-insights
Apache License 2.0
63 stars 9 forks source link

fix: astro check fails on @vercel/speed-insights/astro missing types #41

Closed feugy closed 10 months ago

feugy commented 10 months ago

๐Ÿ““ What's in there?

Fixes #36. It is not possible yet to publish types along an Astro component, and the astro check command will fail on it. As per the Astro team recommendations, we need to specify a file for types, even if it does not exist.

๐Ÿงช How to test?

  1. once the code got retrieved locally, build the whole package: pnpm -F @vercel/speed-insights build
  2. then go to the astro example app cd apps/astro
  3. install typescript and the check command: pnpm i -D typescript @astrojs/check
  4. run it: pnpm exec astro check: it will work, while it used to fail with error:

    src/components/BaseHead.astro:5:27 - error ts(2307): Cannot find module '@vercel/speed-insights/astro' or its corresponding type declarations.
    
    5 import SpeedInsights from '@vercel/speed-insights/astro';

Note: there is still a warning about speedInsightsBeforeSend() unused function, but I couldn't get rid of it.

vercel[bot] commented 10 months ago

The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

Name Status Preview Comments Updated (UTC)
speed-insights-astro โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Jan 16, 2024 8:22am
speed-insights-nextjs โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Jan 16, 2024 8:22am
speed-insights-nuxt โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Jan 16, 2024 8:22am
speed-insights-remix โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Jan 16, 2024 8:22am
speed-insights-sveltekit โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Jan 16, 2024 8:22am
speed-insights-vue โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Jan 16, 2024 8:22am