Skip to content

Commit

Permalink
chore: converted const.js and reportWebVitals.js to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
VaiTon committed Jul 24, 2023
1 parent 3792552 commit 67bbb2d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"web-vitals": "^3.0.4"
},
"devDependencies": {
"@types/node": "^20.4.4",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-react": "^4.0.2",
Expand Down
File renamed without changes.
13 changes: 0 additions & 13 deletions src/reportWebVitals.js

This file was deleted.

15 changes: 15 additions & 0 deletions src/reportWebVitals.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const reportWebVitals = async (
onPerfEntry: undefined | ((value: any) => void) = undefined
) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
const { onCLS, onFID, onFCP, onLCP, onTTFB } = await import("web-vitals");

onCLS(onPerfEntry);
onFID(onPerfEntry);
onFCP(onPerfEntry);
onLCP(onPerfEntry);
onTTFB(onPerfEntry);
}
};

export default reportWebVitals;
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,13 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:^20.4.4":
version: 20.4.4
resolution: "@types/node@npm:20.4.4"
checksum: 43f3c4a8acc38ae753e15a0e79bae0447d255b3742fa87f8e065d7b9d20ecb0e03d6c5b46c00d5d26f4552160381a00255f49205595a8ee48c2423e00263c930
languageName: node
linkType: hard

"@types/parse-json@npm:^4.0.0":
version: 4.0.0
resolution: "@types/parse-json@npm:4.0.0"
Expand Down Expand Up @@ -2029,6 +2036,7 @@ __metadata:
"@mui/material": ^5.11.7
"@mui/x-data-grid": ^5.17.22
"@reduxjs/toolkit": ^1.9.1
"@types/node": ^20.4.4
"@types/react": ^18.0.27
"@types/react-dom": ^18.0.6
"@vitejs/plugin-react": ^4.0.2
Expand Down

0 comments on commit 67bbb2d

Please sign in to comment.