diff options
-rw-r--r-- | client/src/root-helpers/peertube-web-storage.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/client/src/root-helpers/peertube-web-storage.ts b/client/src/root-helpers/peertube-web-storage.ts index 0bbe2c9fc..3622cdc44 100644 --- a/client/src/root-helpers/peertube-web-storage.ts +++ b/client/src/root-helpers/peertube-web-storage.ts | |||
@@ -6,7 +6,8 @@ function proxify (instance: MemoryStorage) { | |||
6 | return new Proxy(instance, { | 6 | return new Proxy(instance, { |
7 | set: function (obj, prop: string | symbol, value) { | 7 | set: function (obj, prop: string | symbol, value) { |
8 | if (Object.prototype.hasOwnProperty.call(MemoryStorage, prop)) { | 8 | if (Object.prototype.hasOwnProperty.call(MemoryStorage, prop)) { |
9 | instance[prop] = value | 9 | // FIXME: remove cast on typescript upgrade |
10 | instance[prop as any] = value | ||
10 | } else { | 11 | } else { |
11 | instance.setItem(prop, value) | 12 | instance.setItem(prop, value) |
12 | } | 13 | } |
@@ -14,8 +15,10 @@ function proxify (instance: MemoryStorage) { | |||
14 | return true | 15 | return true |
15 | }, | 16 | }, |
16 | get: function (target, name: string | symbol | number) { | 17 | get: function (target, name: string | symbol | number) { |
17 | if (typeof instance[name] === 'function') { | 18 | // FIXME: remove cast on typescript upgrade |
18 | return instance[name] | 19 | if (typeof instance[name as any] === 'function') { |
20 | // FIXME: remove cast on typescript upgrade | ||
21 | return instance[name as any] | ||
19 | } else if (valuesMap.has(name)) { | 22 | } else if (valuesMap.has(name)) { |
20 | return instance.getItem(name) | 23 | return instance.getItem(name) |
21 | } | 24 | } |
@@ -24,7 +27,7 @@ function proxify (instance: MemoryStorage) { | |||
24 | } | 27 | } |
25 | 28 | ||
26 | class MemoryStorage implements Storage { | 29 | class MemoryStorage implements Storage { |
27 | [key: string | symbol]: any | 30 | [key: string]: any |
28 | 31 | ||
29 | getItem (key: any) { | 32 | getItem (key: any) { |
30 | const stringKey = String(key) | 33 | const stringKey = String(key) |