fix(store): fix typings

Co-authored-by: Nelson Truran <nelson@truran.dev>
Co-authored-by: dkzlv <dkzlv@pm.me>
pull/29/head
FabianLars 3 years ago
parent 366e17feae
commit 16c955e8a5
No known key found for this signature in database
GPG Key ID: 3B12BC1DEBF61125

@ -29,7 +29,7 @@ export class Store {
* @returns
*/
async set(key: string, value: unknown): Promise<void> {
await invoke("plugin:store|set", {
return await invoke("plugin:store|set", {
path: this.path,
key,
value,
@ -115,7 +115,7 @@ export class Store {
*
* @returns
*/
async values(): Promise<string[]> {
async values<T>(): Promise<T[]> {
return await invoke("plugin:store|values", {
path: this.path,
});
@ -137,7 +137,7 @@ export class Store {
*
* @returns
*/
async length(): Promise<string[]> {
async length(): Promise<number> {
return await invoke("plugin:store|length", {
path: this.path,
});
@ -160,8 +160,8 @@ export class Store {
/**
* Saves the store to disk at the stores `path`.
*
* As the store is only persistet to disk before the apps exit, changes might be lost in a crash.
* This method let's you persist the store to disk whenever you deem necessary.
* As the store is only persisted to disk before the apps exit, changes might be lost in a crash.
* This method lets you persist the store to disk whenever you deem necessary.
* @returns
*/
async save(): Promise<void> {
@ -196,7 +196,7 @@ export class Store {
* @returns A promise resolving to a function to unlisten to the event.
*/
async onChange(
cb: (key: string, value: unknown) => void
cb: (key: string, value: T | null) => void
): Promise<UnlistenFn> {
return await appWindow.listen<ChangePayload<unknown>>(
"store://change",

Loading…
Cancel
Save