mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-04 21:15:45 +02:00
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
This commit is contained in:
@@ -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],
|
||||
}));
|
||||
|
||||
|
||||
@@ -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 });
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user