This commit is contained in:
tamaina 2021-09-06 17:16:30 +09:00
parent 20c26c9dbd
commit ca82538e10
1 changed files with 5 additions and 5 deletions

View File

@ -19,7 +19,7 @@ type EventUnionFromDictionary<
type EventUnionFromMkJSTypes< type EventUnionFromMkJSTypes<
T extends { [key: string]: ((payload: any) => void) | (() => void) }, T extends { [key: string]: ((payload: any) => void) | (() => void) },
U = { [K in keyof T]: { type: K; body: Payload<T[K]>} } U = { [K in keyof T]: { type: K; body: Payload<T[K]>} }
> = U[keyof U] > = U[keyof U];
export type BroadcastStream = EventUnionFromMkJSTypes<StreamTypes.BroadcasrEvents>; export type BroadcastStream = EventUnionFromMkJSTypes<StreamTypes.BroadcasrEvents>;
@ -33,11 +33,11 @@ export interface UserEventTypes {
follow: PackedUser; follow: PackedUser;
unfollow: PackedUser; unfollow: PackedUser;
userAdded: PackedUser; userAdded: PackedUser;
}; }
export type UserEventName = `user:${User['id']}`; export type UserEventName = `user:${User['id']}`;
export type UserEvents = EventUnionFromDictionary<UserEventTypes>; export type UserEvents = EventUnionFromDictionary<UserEventTypes>;
export interface mainStreamTypes { export interface MainStreamTypes {
notification: PackedNotification; notification: PackedNotification;
mention: PackedNote; mention: PackedNote;
reply: PackedNote; reply: PackedNote;
@ -62,9 +62,9 @@ export interface mainStreamTypes {
readAllChannels: never; readAllChannels: never;
unreadChannel: never; unreadChannel: never;
myTokenRegenerated: never; myTokenRegenerated: never;
}; }
export type mainStreamName = `mainStream:${User['id']}`; export type mainStreamName = `mainStream:${User['id']}`;
export type mainStreams = EventUnionFromDictionary<mainStreamTypes>; export type mainStreams = EventUnionFromDictionary<MainStreamTypes>;
interface StreamEvents { interface StreamEvents {
'broadcast': (e: BroadcastStream) => void; 'broadcast': (e: BroadcastStream) => void;