A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v4 60 lines 1.6 kB view raw
1export type Announcement<T> = MRpcBaseMsg & { type: "announcement"; args: T }; 2export type IncompleteArray<T> = ["Missing required items", T]; 3 4export type ActionsWithTunnel< 5 Actions extends Record<string, (...args: any[]) => any>, 6> = { 7 [A in keyof Actions]: WithTunnel<Actions[A]>; 8}; 9 10export type Dependencies<T extends string> = { 11 [K in T]: Worker | SharedWorker; 12}; 13 14/** 15 * Comes from the `@mys/m-rpc` library, 16 * but it is not exported. Used to identify 17 * messages sent via `postMessage`. 18 */ 19export type MRpcBaseMsg = { ns: string; name: string; key: number }; 20 21/** */ 22export type ProxiedActions< 23 Actions extends Record<string, (...args: any[]) => any>, 24> = { 25 [A in keyof Actions]: ProxiedAction<Actions[A]>; 26}; 27 28export type ProxiedAction< 29 Action extends (...args: any[]) => any, 30 PromisedReturn = 31 (ReturnType<Action> extends Promise<unknown> ? ReturnType<Action> 32 : Promise<ReturnType<Action>>), 33> = (...args: Parameters<Action>) => PromisedReturn; 34 35/** */ 36export interface MessengerRealm { 37 postMessage: MessagePort["postMessage"]; 38 addEventListener: MessagePort["addEventListener"]; 39 removeEventListener: MessagePort["removeEventListener"]; 40} 41 42/** */ 43export type Tunnel = { 44 disconnect: () => void; 45 port: MessagePort; 46}; 47 48/** */ 49export type WithTunnel< 50 Fn extends (...args: any[]) => any, 51 PromisedReturn = (ReturnType<Fn> extends Promise<unknown> ? ReturnType<Fn> 52 : Promise<ReturnType<Fn>>), 53> = ( 54 _: { data: Parameters<Fn>[0]; ports: Record<string, MessagePort> }, 55 ...args: Rest<Parameters<Fn>> 56) => PromisedReturn; 57 58// 🛑 59 60type Rest<T> = T extends [any, ...(infer R)[]] ? R : never;