fix(store): fix typings

Co-authored-by: Nelson Truran <nelson@truran.dev>
Co-authored-by: dkzlv <dkzlv@pm.me>
This commit is contained in:
FabianLars
2022-12-15 16:44:42 +01:00
parent 366e17feae
commit 16c955e8a5
+6 -6
View File
@@ -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",