From a9956ccc9717d38f6b9b1ddfcf26b7204ba682a9 Mon Sep 17 00:00:00 2001 From: Jakub Synowiec Date: Sat, 17 Feb 2018 16:08:37 +0100 Subject: [PATCH] Wrap in module --- types/electron-store/index.d.ts | 145 ++++++++++++++++---------------- 1 file changed, 74 insertions(+), 71 deletions(-) diff --git a/types/electron-store/index.d.ts b/types/electron-store/index.d.ts index e270fb2b8e..1bf43b71a8 100644 --- a/types/electron-store/index.d.ts +++ b/types/electron-store/index.d.ts @@ -1,79 +1,82 @@ // Type definitions for electron-store 1.2 // Project: https://github.com/sindresorhus/electron-store // Definitions by: Daniel Perez Alvarez +// Jakub Synowiec // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface ElectronStoreOptions { - /** - * Default config. - */ - defaults?: {}; +declare module 'electron-store' { + interface ElectronStoreOptions { + /** + * Default config. + */ + defaults?: {}; - /** - * Name of the config file (without extension). - */ - name?: string; + /** + * Name of the config file (without extension). + */ + name?: string; - /** - * Storage file location. *Don't specify this unless absolutely necessary!* - */ - cwd?: string; + /** + * Storage file location. *Don't specify this unless absolutely necessary!* + */ + cwd?: string; + } + + class ElectronStore implements Iterable<[string, string | number | boolean | symbol | {}]> { + constructor(options?: ElectronStoreOptions); + + /** + * Sets an item. + */ + set(key: string, value: any): void; + + /** + * Sets multiple items at once. + */ + set(object: {}): void; + + /** + * Retrieves an item. + */ + get(key: string, defaultValue?: any): any; + + /** + * Checks if an item exists. + */ + has(key: string): boolean; + + /** + * Deletes an item. + */ + delete(key: string): void; + + /** + * Deletes all items. + */ + clear(): void; + + /** + * Open the storage file in the user's editor. + */ + openInEditor(): void; + + /** + * Gets the item count. + */ + size: number; + + /** + * Gets all the config as an object or replace the current config with an object. + */ + store: {}; + + /** + * Gets the path to the config file. + */ + path: string; + + [Symbol.iterator](): Iterator<[string, string | number | boolean | symbol | {}]>; + } + + export = ElectronStore; } - -declare class ElectronStore implements Iterable<[string, string | number | boolean | symbol | {}]> { - constructor(options?: ElectronStoreOptions); - - /** - * Sets an item. - */ - set(key: string, value: any): void; - - /** - * Sets multiple items at once. - */ - set(object: {}): void; - - /** - * Retrieves an item. - */ - get(key: string, defaultValue?: any): any; - - /** - * Checks if an item exists. - */ - has(key: string): boolean; - - /** - * Deletes an item. - */ - delete(key: string): void; - - /** - * Deletes all items. - */ - clear(): void; - - /** - * Open the storage file in the user's editor. - */ - openInEditor(): void; - - /** - * Gets the item count. - */ - size: number; - - /** - * Gets all the config as an object or replace the current config with an object. - */ - store: {}; - - /** - * Gets the path to the config file. - */ - path: string; - - [Symbol.iterator](): Iterator<[string, string | number | boolean | symbol | {}]>; -} - -export = ElectronStore;