diff options
Diffstat (limited to 'client/src/root-helpers')
-rw-r--r-- | client/src/root-helpers/peertube-web-storage.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/client/src/root-helpers/peertube-web-storage.ts b/client/src/root-helpers/peertube-web-storage.ts index f29845443..d4cad8a20 100644 --- a/client/src/root-helpers/peertube-web-storage.ts +++ b/client/src/root-helpers/peertube-web-storage.ts | |||
@@ -4,17 +4,19 @@ const valuesMap = new Map() | |||
4 | 4 | ||
5 | function proxify (instance: MemoryStorage) { | 5 | function proxify (instance: MemoryStorage) { |
6 | return new Proxy(instance, { | 6 | return new Proxy(instance, { |
7 | set: function (obj, prop: string | number, value) { | 7 | set: function (obj, prop: string | symbol, value) { |
8 | if (MemoryStorage.prototype.hasOwnProperty(prop)) { | 8 | if (MemoryStorage.prototype.hasOwnProperty(prop)) { |
9 | instance[prop] = value | 9 | // FIXME: symbol typing issue https://github.com/microsoft/TypeScript/issues/1863 |
10 | instance[prop as any] = value | ||
10 | } else { | 11 | } else { |
11 | instance.setItem(prop, value) | 12 | instance.setItem(prop, value) |
12 | } | 13 | } |
13 | return true | 14 | return true |
14 | }, | 15 | }, |
15 | get: function (target, name: string | number) { | 16 | get: function (target, name: string | symbol | number) { |
16 | if (MemoryStorage.prototype.hasOwnProperty(name)) { | 17 | if (MemoryStorage.prototype.hasOwnProperty(name)) { |
17 | return instance[name] | 18 | // FIXME: symbol typing issue https://github.com/microsoft/TypeScript/issues/1863 |
19 | return instance[name as any] | ||
18 | } | 20 | } |
19 | if (valuesMap.has(name)) { | 21 | if (valuesMap.has(name)) { |
20 | return instance.getItem(name) | 22 | return instance.getItem(name) |
@@ -23,9 +25,8 @@ function proxify (instance: MemoryStorage) { | |||
23 | }) | 25 | }) |
24 | } | 26 | } |
25 | 27 | ||
26 | class MemoryStorage { | 28 | class MemoryStorage implements Storage { |
27 | [key: string]: any | 29 | [key: string]: any |
28 | [index: number]: string | ||
29 | 30 | ||
30 | getItem (key: any) { | 31 | getItem (key: any) { |
31 | const stringKey = String(key) | 32 | const stringKey = String(key) |