diff --git a/app/assets/javascripts/services/localStorage.ts b/app/assets/javascripts/services/localStorage.ts index 5f832ea001e..ac20a52433c 100644 --- a/app/assets/javascripts/services/localStorage.ts +++ b/app/assets/javascripts/services/localStorage.ts @@ -2,12 +2,16 @@ export enum StorageKey { DisableErrorReporting = 'DisableErrorReporting', } +export type StorageValue = { + [StorageKey.DisableErrorReporting]: boolean; +} + export const storage = { - get(key: StorageKey) { + get(key: K): StorageValue[K] | null { const value = localStorage.getItem(key); return value ? JSON.parse(value) : null; }, - set(key: StorageKey, value: unknown) { + set(key: K, value: StorageValue[K]) { localStorage.setItem(key, JSON.stringify(value)); }, remove(key: StorageKey) {