Browse Source

Fix building

master
Eduard Kuzmenko 2 years ago
parent
commit
39e658a488
  1. 6
      src/lib/appManagers/appDialogsManager.ts
  2. 6
      src/lib/localStorage.ts
  3. 2
      src/lib/storage.ts

6
src/lib/appManagers/appDialogsManager.ts

@ -111,7 +111,7 @@ interface SortedDialog extends SortedElementBase { @@ -111,7 +111,7 @@ interface SortedDialog extends SortedElementBase {
}
function setPromiseMiddleware<T extends {[smth in K as K]?: CancellablePromise<void>}, K extends keyof T>(obj: T, key: K) {
const oldPromise = obj[key];
const oldPromise: CancellablePromise<void> = obj[key] as any;
if(oldPromise) {
oldPromise.reject();
}
@ -119,12 +119,12 @@ function setPromiseMiddleware<T extends {[smth in K as K]?: CancellablePromise<v @@ -119,12 +119,12 @@ function setPromiseMiddleware<T extends {[smth in K as K]?: CancellablePromise<v
// @ts-ignore
const deferred = obj[key] = deferredPromise<void>();
deferred.catch(() => {}).finally(() => {
if(obj[key] === deferred) {
if((obj[key] as any) === deferred) {
delete obj[key];
}
});
const middleware = middlewarePromise(() => obj[key] === deferred);
const middleware = middlewarePromise(() => (obj[key] as any) === deferred);
return {deferred, middleware};
}

6
src/lib/localStorage.ts

@ -32,7 +32,7 @@ class LocalStorage<Storage extends Record<string, any>> { @@ -32,7 +32,7 @@ class LocalStorage<Storage extends Record<string, any>> {
} else if(this.useStorage) {
let value: Storage[T];
try {
value = localStorage.getItem(this.prefix + key as string) as any;
value = localStorage.getItem(this.prefix + (key as string)) as any;
} catch(err) {
this.useStorage = false;
}
@ -73,7 +73,7 @@ class LocalStorage<Storage extends Record<string, any>> { @@ -73,7 +73,7 @@ class LocalStorage<Storage extends Record<string, any>> {
public delete(key: keyof Storage, saveLocal = false) {
// ! it is needed here
key = '' + key;
key = '' + (key as string);
if(!saveLocal) {
delete this.cache[key];
@ -81,7 +81,7 @@ class LocalStorage<Storage extends Record<string, any>> { @@ -81,7 +81,7 @@ class LocalStorage<Storage extends Record<string, any>> {
// if(this.useStorage) {
try {
localStorage.removeItem(this.prefix + key);
localStorage.removeItem(this.prefix + (key as string));
} catch(err) {
}

2
src/lib/storage.ts

@ -268,7 +268,7 @@ export default class AppStorage< @@ -268,7 +268,7 @@ export default class AppStorage<
} */
// ! it is needed here
key = '' + key;
key = '' + (key as string);
if(!saveLocal) {
delete this.cache[key];

Loading…
Cancel
Save