Link to the code that reproduces this issue
https://github.com/stefanprobst/issue-next-webvitals
To Reproduce
- in the reproduction repo, open
components/analytics.tsx
- see that
metric.name is typed as any (you can also ctrl+click on useReportWebVitals to see that the type import import type { Metric } from 'next/dist/compiled/web-vitals'; does not resolve)
Current vs. Expected behavior
the useReportWebVitals hook accepts a callback (metric: Metric) => void, where the type Metric is imported from next/dist/compiled/web-vitals here. however, next/dist/compiled/web-vitals does not include a .d.ts file, only the .js, so the type import does not resolve.
Verify canary release
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #38~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 2 18:01:13 UTC 2
Binaries:
Node: 20.10.0
npm: 10.2.3
Yarn: 1.22.19
pnpm: 8.12.1
Relevant Packages:
next: 14.0.5-canary.24
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
typescript: 5.3.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
TypeScript (plugin, built-in types)
Additional context
No response
Link to the code that reproduces this issue
https://github.com/stefanprobst/issue-next-webvitals
To Reproduce
components/analytics.tsxmetric.nameis typed asany(you can also ctrl+click onuseReportWebVitalsto see that the type importimport type { Metric } from 'next/dist/compiled/web-vitals';does not resolve)Current vs. Expected behavior
the
useReportWebVitalshook accepts a callback(metric: Metric) => void, where the typeMetricis imported fromnext/dist/compiled/web-vitalshere. however,next/dist/compiled/web-vitalsdoes not include a.d.tsfile, only the.js, so the type import does not resolve.Verify canary release
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #38~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 2 18:01:13 UTC 2 Binaries: Node: 20.10.0 npm: 10.2.3 Yarn: 1.22.19 pnpm: 8.12.1 Relevant Packages: next: 14.0.5-canary.24 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.3.3 Next.js Config: output: N/AWhich area(s) are affected? (Select all that apply)
TypeScript (plugin, built-in types)
Additional context
No response