diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2026-01-09 22:06:40 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-09 22:06:40 +0900 |
| commit | 41592eafb363e3c62ab2d3e5f41b38d7d083d3fb (patch) | |
| tree | 8f69243a5482ad4161eb28b69769684a221aa05c /packages/frontend/src/composables | |
| parent | fix(frontend): popupのemit型が正しく利用できるように修正 (#16... (diff) | |
| download | misskey-41592eafb363e3c62ab2d3e5f41b38d7d083d3fb.tar.gz misskey-41592eafb363e3c62ab2d3e5f41b38d7d083d3fb.tar.bz2 misskey-41592eafb363e3c62ab2d3e5f41b38d7d083d3fb.zip | |
refactor: make noImplicitAny true (#17083)
* wip
* Update emojis.emoji.vue
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Update manager.ts
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Update analytics.ts
Diffstat (limited to 'packages/frontend/src/composables')
5 files changed, 21 insertions, 20 deletions
diff --git a/packages/frontend/src/composables/use-chart-tooltip.ts b/packages/frontend/src/composables/use-chart-tooltip.ts index a42f70ba02..9816de7c14 100644 --- a/packages/frontend/src/composables/use-chart-tooltip.ts +++ b/packages/frontend/src/composables/use-chart-tooltip.ts @@ -4,6 +4,7 @@ */ import { onUnmounted, onDeactivated, ref } from 'vue'; +import type { Chart, ChartType, TooltipModel } from 'chart.js'; import * as os from '@/os.js'; import MkChartTooltip from '@/components/MkChartTooltip.vue'; @@ -40,7 +41,7 @@ export function useChartTooltip(opts: { position: 'top' | 'middle' } = { positio tooltipShowing.value = false; }); - function handler(context) { + function handler(context: { chart: Chart; tooltip: TooltipModel<ChartType> }) { if (context.tooltip.opacity === 0) { tooltipShowing.value = false; return; @@ -48,8 +49,8 @@ export function useChartTooltip(opts: { position: 'top' | 'middle' } = { positio tooltipTitle.value = context.tooltip.title[0]; tooltipSeries.value = context.tooltip.body.map((b, i) => ({ - backgroundColor: context.tooltip.labelColors[i].backgroundColor, - borderColor: context.tooltip.labelColors[i].borderColor, + backgroundColor: context.tooltip.labelColors[i].backgroundColor as string, + borderColor: context.tooltip.labelColors[i].borderColor as string, text: b.lines[0], })); diff --git a/packages/frontend/src/composables/use-form.ts b/packages/frontend/src/composables/use-form.ts index 38e9b40e20..812b66d1f0 100644 --- a/packages/frontend/src/composables/use-form.ts +++ b/packages/frontend/src/composables/use-form.ts @@ -31,7 +31,7 @@ export function useForm<T extends Record<string, any>>(initialState: T, save: (n watch([currentState, previousState], () => { for (const key in modifiedStates) { - modifiedStates[key] = !deepEqual(currentState[key], previousState[key]); + (modifiedStates as any)[key] = !deepEqual(currentState[key], previousState[key]); } }, { deep: true }); diff --git a/packages/frontend/src/composables/use-note-capture.ts b/packages/frontend/src/composables/use-note-capture.ts index 2aeb9074e5..25a9383cd5 100644 --- a/packages/frontend/src/composables/use-note-capture.ts +++ b/packages/frontend/src/composables/use-note-capture.ts @@ -7,6 +7,7 @@ import { onUnmounted, reactive } from 'vue'; import * as Misskey from 'misskey-js'; import { EventEmitter } from 'eventemitter3'; import type { Reactive } from 'vue'; +import type { NoteUpdatedEvent } from 'misskey-js/streaming.types.js'; import { useStream } from '@/stream.js'; import { $i } from '@/i.js'; import { store } from '@/store.js'; @@ -15,9 +16,9 @@ import { prefer } from '@/preferences.js'; import { globalEvents } from '@/events.js'; export const noteEvents = new EventEmitter<{ - [ev: `reacted:${string}`]: (ctx: { userId: Misskey.entities.User['id']; reaction: string; emoji?: { name: string; url: string; }; }) => void; - [ev: `unreacted:${string}`]: (ctx: { userId: Misskey.entities.User['id']; reaction: string; emoji?: { name: string; url: string; }; }) => void; - [ev: `pollVoted:${string}`]: (ctx: { userId: Misskey.entities.User['id']; choice: string; }) => void; + [ev: `reacted:${string}`]: (ctx: { userId: Misskey.entities.User['id']; reaction: string; emoji?: { name: string; url: string; } | null; }) => void; + [ev: `unreacted:${string}`]: (ctx: { userId: Misskey.entities.User['id']; reaction: string; emoji?: { name: string; url: string; } | null; }) => void; + [ev: `pollVoted:${string}`]: (ctx: { userId: Misskey.entities.User['id']; choice: number; }) => void; }>(); const fetchEvent = new EventEmitter<{ @@ -117,7 +118,7 @@ function realtimeSubscribe(props: { const note = props.note; const connection = useStream(); - function onStreamNoteUpdated(noteData): void { + function onStreamNoteUpdated(noteData: NoteUpdatedEvent): void { const { type, id, body } = noteData; if (id !== note.id) return; @@ -136,7 +137,6 @@ function realtimeSubscribe(props: { noteEvents.emit(`unreacted:${id}`, { userId: body.userId, reaction: body.reaction, - emoji: body.emoji, }); break; } @@ -194,9 +194,9 @@ export function useNoteCapture(props: { parentNote: Misskey.entities.Note | null; mock?: boolean; }): { - $note: Reactive<ReactiveNoteData>; - subscribe: () => void; - } { + $note: Reactive<ReactiveNoteData>; + subscribe: () => void; +} { const { note, parentNote, mock } = props; const $note = reactive<ReactiveNoteData>({ @@ -224,7 +224,7 @@ export function useNoteCapture(props: { const reactionUserMap = new Map<Misskey.entities.User['id'], string | typeof noReaction>(); let latestPollVotedKey: string | null = null; - function onReacted(ctx: { userId: Misskey.entities.User['id']; reaction: string; emoji?: { name: string; url: string; }; }): void { + function onReacted(ctx: { userId: Misskey.entities.User['id']; reaction: string; emoji?: { name: string; url: string; } | null; }): void { let normalizedName = ctx.reaction.replace(/^:(\w+):$/, ':$1@.:'); normalizedName = normalizedName.match('\u200d') ? normalizedName : normalizedName.replace(/\ufe0f/g, ''); if (reactionUserMap.has(ctx.userId) && reactionUserMap.get(ctx.userId) === normalizedName) return; @@ -244,7 +244,7 @@ export function useNoteCapture(props: { } } - function onUnreacted(ctx: { userId: Misskey.entities.User['id']; reaction: string; emoji?: { name: string; url: string; }; }): void { + function onUnreacted(ctx: { userId: Misskey.entities.User['id']; reaction: string; emoji?: { name: string; url: string; } | null; }): void { let normalizedName = ctx.reaction.replace(/^:(\w+):$/, ':$1@.:'); normalizedName = normalizedName.match('\u200d') ? normalizedName : normalizedName.replace(/\ufe0f/g, ''); @@ -263,7 +263,7 @@ export function useNoteCapture(props: { } } - function onPollVoted(ctx: { userId: Misskey.entities.User['id']; choice: string; }): void { + function onPollVoted(ctx: { userId: Misskey.entities.User['id']; choice: number; }): void { const newPollVotedKey = `${ctx.userId}:${ctx.choice}`; if (newPollVotedKey === latestPollVotedKey) return; latestPollVotedKey = newPollVotedKey; diff --git a/packages/frontend/src/composables/use-tooltip.ts b/packages/frontend/src/composables/use-tooltip.ts index af76a3a1e8..e369928208 100644 --- a/packages/frontend/src/composables/use-tooltip.ts +++ b/packages/frontend/src/composables/use-tooltip.ts @@ -22,7 +22,7 @@ export function useTooltip( let changeShowingState: (() => void) | null; - let autoHidingTimer; + let autoHidingTimer: number | null = null; const open = () => { close(); @@ -43,7 +43,7 @@ export function useTooltip( isHovering = false; window.clearTimeout(timeoutId); close(); - window.clearInterval(autoHidingTimer); + if (autoHidingTimer != null) window.clearInterval(autoHidingTimer); } }, 1000); }; @@ -66,7 +66,7 @@ export function useTooltip( if (!isHovering) return; isHovering = false; window.clearTimeout(timeoutId); - window.clearInterval(autoHidingTimer); + if (autoHidingTimer != null) window.clearInterval(autoHidingTimer); close(); }; @@ -81,7 +81,7 @@ export function useTooltip( if (!isHovering) return; isHovering = false; window.clearTimeout(timeoutId); - window.clearInterval(autoHidingTimer); + if (autoHidingTimer != null) window.clearInterval(autoHidingTimer); close(); }; diff --git a/packages/frontend/src/composables/use-uploader.ts b/packages/frontend/src/composables/use-uploader.ts index 8ffb1e656b..fabc04895e 100644 --- a/packages/frontend/src/composables/use-uploader.ts +++ b/packages/frontend/src/composables/use-uploader.ts @@ -664,7 +664,7 @@ export function useUploader(options: { if (needsCompress) { const config = { - mimeType: isWebpSupported() ? 'image/webp' : 'image/jpeg', + mimeType: (isWebpSupported() ? 'image/webp' : 'image/jpeg') as 'image/webp' | 'image/jpeg', maxWidth: compressionSettings.maxWidth, maxHeight: compressionSettings.maxHeight, quality: isWebpSupported() ? 0.85 : 0.8, |