Wrap in module

This commit is contained in:
Jakub Synowiec
2018-02-17 16:08:37 +01:00
parent 2e4aad4d1f
commit a9956ccc97
+74 -71
View File
@@ -1,79 +1,82 @@
// Type definitions for electron-store 1.2
// Project: https://github.com/sindresorhus/electron-store
// Definitions by: Daniel Perez Alvarez <https://github.com/unindented>
// Jakub Synowiec <https://github.com/jsynowiec>
// 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;