From 2cd32b2248c6c2e4495ce67e30257f6b5b41633f Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 5 Jan 2024 12:33:47 +0900 Subject: [PATCH] refactor(frontend): reduce type errors --- packages/frontend/src/pages/settings/profile.vue | 4 ++-- packages/frontend/src/pizzax.ts | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/pages/settings/profile.vue b/packages/frontend/src/pages/settings/profile.vue index 57d84b9619..e2d98cbf29 100644 --- a/packages/frontend/src/pages/settings/profile.vue +++ b/packages/frontend/src/pages/settings/profile.vue @@ -140,8 +140,8 @@ const profile = reactive({ location: $i.location, birthday: $i.birthday, lang: $i.lang, - isBot: $i.isBot, - isCat: $i.isCat, + isBot: $i.isBot ?? false, + isCat: $i.isCat ?? false, }); watch(() => profile, () => { diff --git a/packages/frontend/src/pizzax.ts b/packages/frontend/src/pizzax.ts index c6fa89ea5b..8723110b08 100644 --- a/packages/frontend/src/pizzax.ts +++ b/packages/frontend/src/pizzax.ts @@ -225,7 +225,10 @@ export class Storage { * 特定のキーの、簡易的なgetter/setterを作ります * 主にvue場で設定コントロールのmodelとして使う用 */ - public makeGetterSetter(key: K, getter?: (v: T[K]) => unknown, setter?: (v: unknown) => T[K]) { + public makeGetterSetter(key: K, getter?: (v: T[K]) => unknown, setter?: (v: unknown) => T[K]): { + get: () => T[K]['default']; + set: (value: T[K]['default']) => void; + } { const valueRef = ref(this.state[key]); const stop = watch(this.reactiveState[key], val => {