refactor(status): remove null fields
This commit is contained in:
parent
b0d6f310a8
commit
9677f742c8
6 changed files with 38 additions and 46 deletions
|
@ -1,6 +1,6 @@
|
|||
import type { Account, AccountCredentials, Attachment, CreateStatusParams, Emoji, Instance, MastoClient, Notification, PushSubscription, Status } from 'masto'
|
||||
import type { Ref } from 'vue'
|
||||
import type { Mutable } from './utils'
|
||||
import type { MarkNonNullable, Mutable } from './utils'
|
||||
|
||||
export interface AppInfo {
|
||||
id: string
|
||||
|
@ -59,9 +59,7 @@ export type TranslateFn = ReturnType<typeof useI18n>['t']
|
|||
export interface Draft {
|
||||
editingStatus?: Status
|
||||
initialText?: string
|
||||
params: Omit<Mutable<CreateStatusParams>, 'status'> & {
|
||||
status?: Exclude<CreateStatusParams['status'], null>
|
||||
}
|
||||
params: MarkNonNullable<Mutable<CreateStatusParams>, 'status' | 'language' | 'sensitive' | 'spoilerText' | 'visibility'>
|
||||
attachments: Attachment[]
|
||||
}
|
||||
export type DraftMap = Record<string, Draft>
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
export type Mutable<T> = {
|
||||
-readonly[P in keyof T]: T[P]
|
||||
}
|
||||
|
||||
export type Overwrite<T, O> = Omit<T, keyof O> & O
|
||||
export type MarkNonNullable<T, K extends keyof T> = Overwrite<T, {
|
||||
[P in K]-?: NonNullable<T[P]>
|
||||
}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue