From 6468f94c611900115c038cc59faf0586f0c17b07 Mon Sep 17 00:00:00 2001 From: Artur Tamborski Date: Fri, 27 Nov 2020 18:59:55 +0100 Subject: [PATCH] small modifications --- src/reportWebVitals.ts | 23 +++++++++++------------ src/setupTests.ts | 4 ---- tsconfig.json | 2 +- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/reportWebVitals.ts b/src/reportWebVitals.ts index 59d81aa..f1d35b7 100644 --- a/src/reportWebVitals.ts +++ b/src/reportWebVitals.ts @@ -1,15 +1,14 @@ import { ReportHandler } from 'web-vitals'; -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); - }); - } -} +export default function reportWebVitals(onPerfEntry?: ReportHandler) { + if (!onPerfEntry) + return; -export default reportWebVitals; + import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { + getCLS(onPerfEntry); + getFID(onPerfEntry); + getFCP(onPerfEntry); + getLCP(onPerfEntry); + getTTFB(onPerfEntry); + }); +} diff --git a/src/setupTests.ts b/src/setupTests.ts index 8f2609b..7b0828b 100644 --- a/src/setupTests.ts +++ b/src/setupTests.ts @@ -1,5 +1 @@ -// jest-dom adds custom jest matchers for asserting on DOM nodes. -// allows you to do things like: -// expect(element).toHaveTextContent(/react/i) -// learn more: https://github.com/testing-library/jest-dom import '@testing-library/jest-dom'; diff --git a/tsconfig.json b/tsconfig.json index 4c5029e..1672cf8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,7 +21,7 @@ "sourceMap": true, "declaration": true, "noUnusedLocals": true, - "noUnusedParameters": true, +// "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, "incremental": true },