refactor: extend mastodon.v1.Status with extra emoji reactions props

This commit is contained in:
TAKAHASHI Shuuji 2025-05-17 10:17:49 +09:00
parent 967c8f3bcd
commit 9fb52702e5
2 changed files with 21 additions and 18 deletions

View file

@ -1,24 +1,6 @@
import type { mastodon } from 'masto'
type Action = 'reblogged' | 'favourited' | 'bookmarked' | 'pinned' | 'muted' type Action = 'reblogged' | 'favourited' | 'bookmarked' | 'pinned' | 'muted'
type CountField = 'reblogsCount' | 'favouritesCount' 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 { export interface StatusActionsProps {
status: Status status: Status
} }

21
types/global.d.ts vendored Normal file
View file

@ -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[]
}
}