GoogleChrome / web-vitals

Essential metrics for a healthy site.
https://web.dev/vitals
Apache License 2.0
7.47k stars 410 forks source link

Add the `ReportCallback` type back but deprecate it #483

Closed philipwalton closed 3 months ago

philipwalton commented 3 months ago

Fixes #482 by re-adding the ReportCallback type but marking it as deprecated.

In most cases developers should not need to explicitly type their metric function callbacks (e.g. the type can be inferred from usage), but in the event that you do, the recommended replacement for ReportCallback is either:

The MetricType type can be imported as follows:

// If using the "standard" build:
import type {MetricType} from 'web-vitals';

// If using the "attribution" build:
import type {MetricType} from 'web-vitals/attribution';