Convert components/status to Typescript

This commit is contained in:
Alex Gleason 2022-03-31 14:13:43 -05:00
parent 733d240893
commit c4dd3c65f9
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
5 changed files with 15 additions and 3 deletions

View file

@ -39,7 +39,7 @@ export const AccountRecord = ImmutableRecord({
last_status_at: new Date(),
location: '',
locked: false,
moved: null as EmbeddedEntity<any> | null,
moved: null as EmbeddedEntity<any>,
note: '',
pleroma: ImmutableMap<string, any>(),
source: ImmutableMap<string, any>(),

View file

@ -31,6 +31,7 @@ export const StatusRecord = ImmutableRecord({
emojis: ImmutableList<Emoji>(),
favourited: false,
favourites_count: 0,
group: null as EmbeddedEntity<any>,
in_reply_to_account_id: null as string | null,
in_reply_to_id: null as string | null,
id: '',
@ -55,6 +56,7 @@ export const StatusRecord = ImmutableRecord({
// Internal fields
contentHtml: '',
expectsCard: false,
filtered: false,
hidden: false,
search_index: '',

View file

@ -14,7 +14,6 @@ import {
import type { Record as ImmutableRecord } from 'immutable';
type Account = ReturnType<typeof AccountRecord>;
type Attachment = ReturnType<typeof AttachmentRecord>;
type Card = ReturnType<typeof CardRecord>;
type Emoji = ReturnType<typeof EmojiRecord>;
@ -24,7 +23,18 @@ type Mention = ReturnType<typeof MentionRecord>;
type Notification = ReturnType<typeof NotificationRecord>;
type Poll = ReturnType<typeof PollRecord>;
type PollOption = ReturnType<typeof PollOptionRecord>;
type Status = ReturnType<typeof StatusRecord>;
interface Account extends ReturnType<typeof AccountRecord> {
// HACK: we can't do a circular reference in the Record definition itself,
// so do it here.
moved: EmbeddedEntity<Account>;
}
interface Status extends ReturnType<typeof StatusRecord> {
// HACK: same as above
quote: EmbeddedEntity<Status>;
reblog: EmbeddedEntity<Status>;
}
// Utility types
type APIEntity = Record<string, any>;