mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-11 00:44:07 +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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user