typing loadFromStorage wip

This commit is contained in:
Mikhail Mikheev 2020-06-23 13:53:10 +04:00
parent 231a9a7d35
commit 18f03b8bc1
2 changed files with 4 additions and 4 deletions

View File

@ -10,10 +10,10 @@ const watchedActions = [ADD_PROVIDER, REMOVE_PROVIDER]
const LAST_USED_PROVIDER_KEY = 'LAST_USED_PROVIDER'
export const loadLastUsedProvider = async () => {
const lastUsedProvider = await loadFromStorage(LAST_USED_PROVIDER_KEY)
export const loadLastUsedProvider = async (): Promise<string | undefined> => {
const lastUsedProvider = await loadFromStorage<string>(LAST_USED_PROVIDER_KEY)
return lastUsedProvider || ''
return lastUsedProvider
}
let watcherInterval = null

View File

@ -10,7 +10,7 @@ export const storage = new ImmortalStorage(stores)
const PREFIX = `v2_${getNetwork()}`
export const loadFromStorage = async <T extends () => unknown>(key: string): Promise<T> => {
export const loadFromStorage = async <T extends unknown>(key: string): Promise<T | undefined> => {
try {
const stringifiedValue = await storage.get(`${PREFIX}__${key}`)
if (stringifiedValue === null || stringifiedValue === undefined) {