refactor(frontend): reduce type errors
This commit is contained in:
parent
fa9c4a19b9
commit
2cd32b2248
|
@ -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, () => {
|
||||||
|
|
|
@ -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 => {
|
||||||
|
|
Loading…
Reference in a new issue