diff --git a/src/main.ts b/src/main.ts index 0ca965ab..29d4b1ea 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,6 +9,7 @@ import { registerSW } from 'virtual:pwa-register'; import shadow from 'vue-shadow-dom'; import { hideSplashScreen } from 'vite-plugin-splash-screen/runtime'; import { plausible } from './plugins/plausible.plugin'; +import '@/utils/json5-bigint'; import 'virtual:uno.css'; @@ -20,6 +21,11 @@ import { i18nPlugin } from './plugins/i18n.plugin'; import store from './tools/pomodoro-timer/app/store'; +// eslint-disable-next-line no-extend-native +BigInt.prototype.toJSON = function () { + return JSON.rawJSON ? JSON.rawJSON(this.toString()) : this.toString(); +}; + library.add(fas); registerSW(); diff --git a/src/shims.d.ts b/src/shims.d.ts index e3500397..ad25c1c0 100644 --- a/src/shims.d.ts +++ b/src/shims.d.ts @@ -43,3 +43,12 @@ declare module 'pdf-signature-reader' { declare module 'vite-plugin-splash-screen/runtime' { export function hideSplashScreen(); } + +interface BigInt { + toJSON: () => string; +} + +interface JSON { + parseBigInt: (jsonStr: string, options?: { minDigits?: number; fallbackToString?: boolean; }) => any; + rawJSON(value: string): any; +} diff --git a/src/tools/javascript-to-json/javascript-to-json.vue b/src/tools/javascript-to-json/javascript-to-json.vue index 2b3cfb14..d154fb97 100644 --- a/src/tools/javascript-to-json/javascript-to-json.vue +++ b/src/tools/javascript-to-json/javascript-to-json.vue @@ -1,6 +1,5 @@