diff --git a/frontend/src/reportWebVitals.ts b/frontend/src/reportWebVitals.ts index 49a2a16..569d5db 100644 --- a/frontend/src/reportWebVitals.ts +++ b/frontend/src/reportWebVitals.ts @@ -1,13 +1,14 @@ -import { ReportHandler } from 'web-vitals'; +import { CLSMetric, FCPMetric, FIDMetric, LCPMetric, TTFBMetric } from 'web-vitals'; + +type ReportHandler = (metric: CLSMetric | FIDMetric | FCPMetric | LCPMetric | TTFBMetric) => void; const reportWebVitals = (onPerfEntry?: ReportHandler) => { if (onPerfEntry && onPerfEntry instanceof Function) { - import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { - getCLS(onPerfEntry); - getFID(onPerfEntry); - getFCP(onPerfEntry); - getLCP(onPerfEntry); - getTTFB(onPerfEntry); + import('web-vitals').then(({ onCLS, onFCP, onLCP, onTTFB }) => { + onCLS(onPerfEntry); + onFCP(onPerfEntry); + onLCP(onPerfEntry); + onTTFB(onPerfEntry); }); } };