]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/root-helpers/peertube-web-storage.ts
Refactor a little bit watch html
[github/Chocobozzz/PeerTube.git] / client / src / root-helpers / peertube-web-storage.ts
index f29845443ab8207be9a017f44fb0418284f67c71..d4cad8a20aa74f6c25ab24ede76117292c590691 100644 (file)
@@ -4,17 +4,19 @@ const valuesMap = new Map()
 
 function proxify (instance: MemoryStorage) {
   return new Proxy(instance, {
-    set: function (obj, prop: string | number, value) {
+    set: function (obj, prop: string | symbol, value) {
       if (MemoryStorage.prototype.hasOwnProperty(prop)) {
-        instance[prop] = value
+        // FIXME: symbol typing issue https://github.com/microsoft/TypeScript/issues/1863
+        instance[prop as any] = value
       } else {
         instance.setItem(prop, value)
       }
       return true
     },
-    get: function (target, name: string | number) {
+    get: function (target, name: string | symbol | number) {
       if (MemoryStorage.prototype.hasOwnProperty(name)) {
-        return instance[name]
+        // FIXME: symbol typing issue https://github.com/microsoft/TypeScript/issues/1863
+        return instance[name as any]
       }
       if (valuesMap.has(name)) {
         return instance.getItem(name)
@@ -23,9 +25,8 @@ function proxify (instance: MemoryStorage) {
   })
 }
 
-class MemoryStorage {
+class MemoryStorage implements Storage {
   [key: string]: any
-  [index: number]: string
 
   getItem (key: any) {
     const stringKey = String(key)