From 316a8c7525ffb36d0fd74f3f0e10c1e8ceb5e80b Mon Sep 17 00:00:00 2001 From: igl00 Date: Sun, 18 Nov 2018 14:34:28 +1300 Subject: [PATCH] Add declarations for storage modules to store --- types/store/index.d.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/types/store/index.d.ts b/types/store/index.d.ts index 8f46bb9f59..e859491aa0 100644 --- a/types/store/index.d.ts +++ b/types/store/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Vincent Bortone // harry0000 // Roman Nuritdinov (Ky6uk) +// Johnny Edwards (igl00) // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Cross-browser storage for all use cases, used across the web. @@ -25,6 +26,15 @@ interface StoreJsEngine { createStore(storages: any[], plugins?: any[], namespace?: string): StoreJsAPI; } +interface StoreJsStorage { + name: string; + read: (key: string) => string | null; + write: (key: string, data: string) => void; + each: (callback: (val: string, key: string) => any) => void; + remove: (key: string) => void; + clearAll: () => void; +} + declare const store: StoreJsAPI; declare module 'store' { export = store; @@ -73,3 +83,23 @@ declare module 'store/plugins/update' { declare module 'store/plugins/v1-backcompat' { export = Function; } + +declare const storage: StoreJsStorage; +declare module 'store/storages/cookieStorage' { + export = storage; +} +declare module 'store/storages/localStorage' { + export = storage; +} +declare module 'store/storages/memoryStorage' { + export = storage; +} +declare module 'store/storages/oldFF-globalStorage' { + export = storage; +} +declare module 'store/storages/oldIE-userDataStorage' { + export = storage; +} +declare module 'store/storages/sessionStorage' { + export = storage; +}