From f12868220067ebc640db8c8c2a34fd3b575d3d26 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Sat, 5 Jul 2025 17:13:29 +0900 Subject: [PATCH] fix type errors --- packages/backend/src/models/json-schema/flash.ts | 2 +- packages/frontend/src/components/MkRolePreview.vue | 2 +- packages/frontend/src/pages/chat/message.vue | 2 +- packages/frontend/src/pages/chat/room.vue | 2 +- packages/frontend/src/pages/flash/flash-index.vue | 2 +- packages/frontend/src/pages/install-extensions.vue | 4 ++-- packages/frontend/src/pages/instance-info.vue | 2 +- packages/frontend/src/pages/list.vue | 5 +++++ packages/misskey-js/src/autogen/types.ts | 2 +- 9 files changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/backend/src/models/json-schema/flash.ts b/packages/backend/src/models/json-schema/flash.ts index 42b2172409..d50200e6e9 100644 --- a/packages/backend/src/models/json-schema/flash.ts +++ b/packages/backend/src/models/json-schema/flash.ts @@ -51,7 +51,7 @@ export const packedFlashSchema = { }, likedCount: { type: 'number', - optional: false, nullable: true, + optional: false, nullable: false, }, isLiked: { type: 'boolean', diff --git a/packages/frontend/src/components/MkRolePreview.vue b/packages/frontend/src/components/MkRolePreview.vue index 3f14c5b5e0..15149b3f0c 100644 --- a/packages/frontend/src/components/MkRolePreview.vue +++ b/packages/frontend/src/components/MkRolePreview.vue @@ -41,7 +41,7 @@ import { i18n } from '@/i18n.js'; const props = withDefaults(defineProps<{ role: Misskey.entities.Role; forModeration: boolean; - detailed: boolean; + detailed?: boolean; }>(), { detailed: true, }); diff --git a/packages/frontend/src/pages/chat/message.vue b/packages/frontend/src/pages/chat/message.vue index a04ec7fd87..834aa9e033 100644 --- a/packages/frontend/src/pages/chat/message.vue +++ b/packages/frontend/src/pages/chat/message.vue @@ -25,7 +25,7 @@ import { misskeyApi } from '@/utility/misskey-api.js'; import { definePage } from '@/page.js'; const props = defineProps<{ - messageId?: string; + messageId: string; }>(); const initializing = ref(true); diff --git a/packages/frontend/src/pages/chat/room.vue b/packages/frontend/src/pages/chat/room.vue index ac13c5fac6..6443616fe3 100644 --- a/packages/frontend/src/pages/chat/room.vue +++ b/packages/frontend/src/pages/chat/room.vue @@ -197,7 +197,7 @@ async function initialize() { connection.value.on('deleted', onDeleted); connection.value.on('react', onReact); connection.value.on('unreact', onUnreact); - } else { + } else if (props.roomId) { const [rResult, mResult] = await Promise.allSettled([ misskeyApi('chat/rooms/show', { roomId: props.roomId }), misskeyApi('chat/messages/room-timeline', { roomId: props.roomId, limit: LIMIT }), diff --git a/packages/frontend/src/pages/flash/flash-index.vue b/packages/frontend/src/pages/flash/flash-index.vue index 43632f55ca..74d8d639f3 100644 --- a/packages/frontend/src/pages/flash/flash-index.vue +++ b/packages/frontend/src/pages/flash/flash-index.vue @@ -67,7 +67,7 @@ const router = useRouter(); const tab = ref('featured'); const searchQuery = ref(''); -const searchPaginator = shallowRef(null); +const searchPaginator = shallowRef | null>(null); const searchKey = ref(0); const featuredFlashsPaginator = markRaw(new Paginator('flash/featured', { diff --git a/packages/frontend/src/pages/install-extensions.vue b/packages/frontend/src/pages/install-extensions.vue index 4e814ef84f..1b3c6616cc 100644 --- a/packages/frontend/src/pages/install-extensions.vue +++ b/packages/frontend/src/pages/install-extensions.vue @@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
- + @@ -151,7 +151,7 @@ async function fetch() { case 'theme': try { const metaRaw = parseThemeCode(res.data); - // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { id, props, desc: description, ...meta } = metaRaw; data.value = { type: 'theme', diff --git a/packages/frontend/src/pages/instance-info.vue b/packages/frontend/src/pages/instance-info.vue index 14a64f0bd5..4be5fa447d 100644 --- a/packages/frontend/src/pages/instance-info.vue +++ b/packages/frontend/src/pages/instance-info.vue @@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only
- + {{ instance.name || `(${i18n.ts.unknown})` }}
diff --git a/packages/frontend/src/pages/list.vue b/packages/frontend/src/pages/list.vue index 4368aff8be..1261428c1c 100644 --- a/packages/frontend/src/pages/list.vue +++ b/packages/frontend/src/pages/list.vue @@ -62,24 +62,29 @@ function fetchList(): void { } function like() { + if (list.value == null) return; os.apiWithDialog('users/lists/favorite', { listId: list.value.id, }).then(() => { + if (list.value == null) return; list.value.isLiked = true; list.value.likedCount++; }); } function unlike() { + if (list.value == null) return; os.apiWithDialog('users/lists/unfavorite', { listId: list.value.id, }).then(() => { + if (list.value == null) return; list.value.isLiked = false; list.value.likedCount--; }); } async function create() { + if (list.value == null) return; const { canceled, result: name } = await os.inputText({ title: i18n.ts.enterListName, }); diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index 78d509838b..bea4090aba 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -5077,7 +5077,7 @@ export type components = { script: string; /** @enum {string} */ visibility: 'private' | 'public'; - likedCount: number | null; + likedCount: number; isLiked?: boolean; }; Signin: {