mirror of
https://github.com/bartvdbraak/hellob.art.git
synced 2025-05-01 19:41:22 +00:00
fix: rectify typescript rules
This commit is contained in:
parent
8c5bbe2e77
commit
04e711d232
1 changed files with 2 additions and 6 deletions
|
@ -3,15 +3,13 @@ import { onCLS, onFCP, onFID, onLCP, onTTFB } from 'web-vitals';
|
|||
|
||||
const vitalsUrl = 'https://vitals.vercel-analytics.com/v1/vitals';
|
||||
|
||||
// Improve type safety by defining the navigator.connection type
|
||||
interface NavigatorWithConnection extends Navigator {
|
||||
connection: {
|
||||
effectiveType: string;
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type Params = Record<string, any>; // Define a type for 'params'
|
||||
type Params = Record<string, string>;
|
||||
|
||||
function getConnectionSpeed() {
|
||||
return 'connection' in navigator &&
|
||||
|
@ -49,10 +47,8 @@ function sendToAnalytics(
|
|||
console.log('[Web Vitals]', metric.name, JSON.stringify(body, null, 2));
|
||||
}
|
||||
|
||||
// Serialize body to a URLSearchParams object
|
||||
const searchParams = new URLSearchParams(body);
|
||||
|
||||
// The type 'Record<string, string>' is compatible with 'URLSearchParams'
|
||||
const blob = new Blob([searchParams.toString()], {
|
||||
type: 'application/x-www-form-urlencoded'
|
||||
});
|
||||
|
@ -69,7 +65,7 @@ function sendToAnalytics(
|
|||
}
|
||||
|
||||
export function webVitals(options: {
|
||||
params: Params; // Use the defined 'Params' type here
|
||||
params: Params;
|
||||
path: string;
|
||||
analyticsId: string;
|
||||
debug: boolean;
|
||||
|
|
Loading…
Reference in a new issue