1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-05 10:18:09 +09:00

refactor(frontend): reduce type errors

This commit is contained in:
syuilo 2024-01-05 12:33:47 +09:00
parent fa9c4a19b9
commit 2cd32b2248
2 changed files with 6 additions and 3 deletions

View File

@ -140,8 +140,8 @@ const profile = reactive({
location: $i.location, location: $i.location,
birthday: $i.birthday, birthday: $i.birthday,
lang: $i.lang, lang: $i.lang,
isBot: $i.isBot, isBot: $i.isBot ?? false,
isCat: $i.isCat, isCat: $i.isCat ?? false,
}); });
watch(() => profile, () => { watch(() => profile, () => {

View File

@ -225,7 +225,10 @@ export class Storage<T extends StateDef> {
* getter/setterを作ります * getter/setterを作ります
* vue場で設定コントロールのmodelとして使う用 * vue場で設定コントロールのmodelとして使う用
*/ */
public makeGetterSetter<K extends keyof T>(key: K, getter?: (v: T[K]) => unknown, setter?: (v: unknown) => T[K]) { public makeGetterSetter<K extends keyof T>(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 valueRef = ref(this.state[key]);
const stop = watch(this.reactiveState[key], val => { const stop = watch(this.reactiveState[key], val => {