Fix client build

pull/4461/head
Chocobozzz 2021-10-08 14:51:03 +02:00
parent e93ee83825
commit 52d1477ac4
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 7 additions and 4 deletions

View File

@ -6,7 +6,8 @@ function proxify (instance: MemoryStorage) {
return new Proxy(instance, { return new Proxy(instance, {
set: function (obj, prop: string | symbol, value) { set: function (obj, prop: string | symbol, value) {
if (Object.prototype.hasOwnProperty.call(MemoryStorage, prop)) { if (Object.prototype.hasOwnProperty.call(MemoryStorage, prop)) {
instance[prop] = value // FIXME: remove cast on typescript upgrade
instance[prop as any] = value
} else { } else {
instance.setItem(prop, value) instance.setItem(prop, value)
} }
@ -14,8 +15,10 @@ function proxify (instance: MemoryStorage) {
return true return true
}, },
get: function (target, name: string | symbol | number) { get: function (target, name: string | symbol | number) {
if (typeof instance[name] === 'function') { // FIXME: remove cast on typescript upgrade
return instance[name] if (typeof instance[name as any] === 'function') {
// FIXME: remove cast on typescript upgrade
return instance[name as any]
} else if (valuesMap.has(name)) { } else if (valuesMap.has(name)) {
return instance.getItem(name) return instance.getItem(name)
} }
@ -24,7 +27,7 @@ function proxify (instance: MemoryStorage) {
} }
class MemoryStorage implements Storage { class MemoryStorage implements Storage {
[key: string | symbol]: any [key: string]: any
getItem (key: any) { getItem (key: any) {
const stringKey = String(key) const stringKey = String(key)