From 0d91e9077b3075e45998d82b4ff67d01badeb1a8 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Wed, 22 Mar 2023 20:01:05 +0000 Subject: [PATCH] fix: types errors --- .gitignore | 9 +++++---- public/worker-development.js | 5 ----- src/pages/dashboard/[subdomain]/editor.tsx | 10 ++++++---- tsconfig.json | 3 ++- types/global.d.ts | 10 ++++++++++ 5 files changed, 23 insertions(+), 14 deletions(-) delete mode 100644 public/worker-development.js create mode 100644 types/global.d.ts diff --git a/.gitignore b/.gitignore index 3985bc30..c2ad687b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,8 @@ test-results/ .idea .vscode -sw.js -sw.js.map -workbox-*.js -workbox-*.js.map +public/sw.js +public/sw.js.map +public/workbox-*.js +public/workbox-*.js.map +public/worker-*.js \ No newline at end of file diff --git a/public/worker-development.js b/public/worker-development.js deleted file mode 100644 index 41d931cd..00000000 --- a/public/worker-development.js +++ /dev/null @@ -1,5 +0,0 @@ -/******/ (() => { // webpackBootstrap -var __webpack_exports__ = {}; -self.__WB_DISABLE_DEV_LOGS = true; -/******/ })() -; \ No newline at end of file diff --git a/src/pages/dashboard/[subdomain]/editor.tsx b/src/pages/dashboard/[subdomain]/editor.tsx index e1e4c646..52d5b69f 100644 --- a/src/pages/dashboard/[subdomain]/editor.tsx +++ b/src/pages/dashboard/[subdomain]/editor.tsx @@ -511,10 +511,12 @@ export default function SubdomainEditor() { date.dayjs, )} onChange={(e: ChangeEvent) => { - const value = date - .inLocalTimezone(e.target.value) - .toISOString() - updateValue("publishedAt", value) + try { + const value = date + .inLocalTimezone(e.target.value) + .toISOString() + updateValue("publishedAt", value) + } catch (error) {} }} help={t( `This ${ diff --git a/tsconfig.json b/tsconfig.json index 0cb9e9bc..b9c9ccd1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,7 +17,8 @@ "allowJs": true, "skipLibCheck": true, "incremental": true, - "module": "esnext" + "module": "esnext", + "typeRoots": ["./types"] }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], "exclude": ["node_modules"] diff --git a/types/global.d.ts b/types/global.d.ts new file mode 100644 index 00000000..66863a53 --- /dev/null +++ b/types/global.d.ts @@ -0,0 +1,10 @@ +export {} + +declare global { + interface Array { + findLastIndex( + predicate: (value: T, index: number, obj: T[]) => unknown, + thisArg?: any, + ): number + } +}