From 19f8f095c7e02124dbf04e70f61ce988f490415d Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Sun, 4 Sep 2022 19:31:11 -0400 Subject: [PATCH] client: add return types to functions --- packages/client/src/instance.ts | 2 +- packages/client/src/nirax.ts | 14 +++++++------- packages/client/src/pizzax.ts | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/client/src/instance.ts b/packages/client/src/instance.ts index 14795163a..e04487b8d 100644 --- a/packages/client/src/instance.ts +++ b/packages/client/src/instance.ts @@ -12,7 +12,7 @@ export const instance: Misskey.entities.InstanceMetadata = reactive(instanceData // TODO: set default values }); -export async function fetchInstance() { +export async function fetchInstance(): Promise { const meta = await api('meta', { detail: false, }); diff --git a/packages/client/src/nirax.ts b/packages/client/src/nirax.ts index 8dbe7eb12..51f1dc20a 100644 --- a/packages/client/src/nirax.ts +++ b/packages/client/src/nirax.ts @@ -163,7 +163,7 @@ export class Router extends EventEmitter<{ return null; } - private navigate(path: string, key: string | null | undefined, initial = false) { + private navigate(path: string, key: string | null | undefined, initial = false): void { const beforePath = this.currentPath; this.currentPath = path; @@ -195,23 +195,23 @@ export class Router extends EventEmitter<{ } } - public getCurrentComponent() { + public getCurrentComponent(): Component | null { return this.currentComponent; } - public getCurrentProps() { + public getCurrentProps(): Map | null { return this.currentProps; } - public getCurrentPath() { + public getCurrentPath(): string { return this.currentPath; } - public getCurrentKey() { + public getCurrentKey(): string { return this.currentKey; } - public push(path: string) { + public push(path: string): void { const beforePath = this.currentPath; if (path === beforePath) { this.emit('same'); @@ -231,7 +231,7 @@ export class Router extends EventEmitter<{ }); } - public change(path: string, key?: string | null) { + public change(path: string, key?: string | null): void { this.navigate(path, key); } } diff --git a/packages/client/src/pizzax.ts b/packages/client/src/pizzax.ts index d48f6ba6b..beacb6bc0 100644 --- a/packages/client/src/pizzax.ts +++ b/packages/client/src/pizzax.ts @@ -130,7 +130,7 @@ export class Storage { this.set(key, [...currentState, value]); } - public reset(key: keyof T) { + public reset(key: keyof T): void { this.set(key, this.def[key].default); }