From 9fb52702e5a3fb6cde8c0f9d44117d292245632d Mon Sep 17 00:00:00 2001 From: TAKAHASHI Shuuji Date: Sat, 17 May 2025 10:17:49 +0900 Subject: [PATCH] refactor: extend mastodon.v1.Status with extra emoji reactions props --- composables/masto/status.ts | 18 ------------------ types/global.d.ts | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 types/global.d.ts diff --git a/composables/masto/status.ts b/composables/masto/status.ts index 2662eae2..341da775 100644 --- a/composables/masto/status.ts +++ b/composables/masto/status.ts @@ -1,24 +1,6 @@ -import type { mastodon } from 'masto' - type Action = 'reblogged' | 'favourited' | 'bookmarked' | 'pinned' | 'muted' type CountField = 'reblogsCount' | 'favouritesCount' -// Add EmojiReaction type to support fedibird non-mastodon emoji reaction -export interface EmojiReaction { - name: string - count: number - accountIds: string[] - me: boolean - // Only used by custom emoji - url?: string - staticUrl?: string - domain?: string | null - width?: number - height?: number -} - -export type Status = mastodon.v1.Status & { emojiReactionsCount?: number, emojiReactions?: EmojiReaction[] } - export interface StatusActionsProps { status: Status } diff --git a/types/global.d.ts b/types/global.d.ts new file mode 100644 index 00000000..64165b6d --- /dev/null +++ b/types/global.d.ts @@ -0,0 +1,21 @@ +import 'masto' + +declare module 'masto/mastodon/entities/v1/index.js' { + // support fedibird non-mastodon emoji reaction + interface EmojiReaction { + name: string + count: number + accountIds: string[] + me: boolean + url?: string + staticUrl?: string + domain?: string | null + width?: number + height?: number + } + + interface Status { + emojiReactionsCount?: number + emojiReactions?: EmojiReaction[] + } +}