mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Update comments using official package docs
This commit is contained in:
124
types/electron-store/index.d.ts
vendored
124
types/electron-store/index.d.ts
vendored
@@ -14,83 +14,87 @@ declare module 'electron-store' {
|
||||
interface JSONArray extends Array<JSONValue> {}
|
||||
|
||||
interface ElectronStoreOptions<T = JSONObject> {
|
||||
/**
|
||||
* Default config.
|
||||
*/
|
||||
defaults?: T;
|
||||
/**
|
||||
* Default data.
|
||||
*/
|
||||
defaults?: T;
|
||||
|
||||
/**
|
||||
* Name of the config file (without extension).
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* Name of the storage 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<T> implements Iterable<[keyof T, JSONValue]> {
|
||||
constructor(options?: ElectronStoreOptions<T>);
|
||||
constructor(options?: ElectronStoreOptions<T>);
|
||||
|
||||
/**
|
||||
* Sets an item.
|
||||
*/
|
||||
set<K extends keyof T>(key: K, value: T[K]): void;
|
||||
set(key: string, value: any): void;
|
||||
/**
|
||||
* Set an item.
|
||||
*/
|
||||
set<K extends keyof T>(key: K, value: T[K]): void;
|
||||
set(key: string, value: any): void;
|
||||
|
||||
/**
|
||||
* Sets multiple items at once.
|
||||
*/
|
||||
set<K extends keyof T>(object: Pick<T, K> | T): void;
|
||||
set(object: JSONObject): void
|
||||
/**
|
||||
* Set multiple items at once.
|
||||
*/
|
||||
set<K extends keyof T>(object: Pick<T, K> | T): void;
|
||||
set(object: JSONObject): void
|
||||
|
||||
/**
|
||||
* Retrieves an item.
|
||||
*/
|
||||
get<K extends keyof T>(key: K, defaultValue?: JSONValue): T[K];
|
||||
get(key: string, defaultValue?: any): any;
|
||||
/**
|
||||
* Get an item or defaultValue if the item does not exist.
|
||||
*/
|
||||
get<K extends keyof T>(key: K, defaultValue?: JSONValue): T[K];
|
||||
get(key: string, defaultValue?: any): any;
|
||||
|
||||
/**
|
||||
* Checks if an item exists.
|
||||
*/
|
||||
has<K extends keyof T>(key: K | string): boolean;
|
||||
/**
|
||||
* Check if an item exists.
|
||||
*/
|
||||
has<K extends keyof T>(key: K | string): boolean;
|
||||
|
||||
/**
|
||||
* Deletes an item.
|
||||
*/
|
||||
delete<K extends keyof T>(key: K | string): void;
|
||||
/**
|
||||
* Delete an item.
|
||||
*/
|
||||
delete<K extends keyof T>(key: K | string): void;
|
||||
|
||||
/**
|
||||
* Deletes all items.
|
||||
*/
|
||||
clear(): void;
|
||||
/**
|
||||
* Delete all items.
|
||||
*/
|
||||
clear(): void;
|
||||
|
||||
/**
|
||||
* Open the storage file in the user's editor.
|
||||
*/
|
||||
openInEditor(): void;
|
||||
/**
|
||||
* Watches the given key, calling callback on any changes. When a key is first set oldValue
|
||||
* will be undefined, and when a key is deleted newValue will be undefined.
|
||||
*/
|
||||
onDidChange<K extends keyof T>(key: K, callback: (newValue: T[K], oldValue: T[K]) => void): void;
|
||||
onDidChange(key: string, callback: (newValue: JSONValue, oldValue: JSONValue) => void): void;
|
||||
|
||||
onDidChange<K extends keyof T>(key: K, callback: (newValue: T[K], oldValue: T[K]) => void): void;
|
||||
onDidChange(key: string, callback: (newValue: JSONValue, oldValue: JSONValue) => void): void;
|
||||
/**
|
||||
* Get the item count.
|
||||
*/
|
||||
size: number;
|
||||
|
||||
/**
|
||||
* Gets the item count.
|
||||
*/
|
||||
size: number;
|
||||
/**
|
||||
* Get all the data as an object or replace the current data with an object.
|
||||
*/
|
||||
store: T;
|
||||
|
||||
/**
|
||||
* Gets all the config as an object or replace the current config with an object.
|
||||
*/
|
||||
store: T;
|
||||
/**
|
||||
* Get the path to the storage file.
|
||||
*/
|
||||
path: string;
|
||||
|
||||
/**
|
||||
* Gets the path to the config file.
|
||||
*/
|
||||
path: string;
|
||||
/**
|
||||
* Open the storage file in the user's editor.
|
||||
*/
|
||||
openInEditor(): void;
|
||||
|
||||
[Symbol.iterator](): Iterator<[keyof T, JSONValue]>;
|
||||
[Symbol.iterator](): Iterator<[keyof T, JSONValue]>;
|
||||
}
|
||||
|
||||
export = ElectronStore;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user