type Method = "GET" | "POST" | "PUT" | "DELETE" | "PATCH"; export interface FrontendApiEndpoint { method: M; path: P; request?: T; response?: R; } function endpointDef( method: Method, path: string ): FrontendApiEndpoint { return { method, path, }; } export const feEndpoints = { defaultSounds: endpointDef<{}, string[]>("GET", "default-sounds"), } as const; type Endpoints = typeof feEndpoints; export type FrontendApiEndpoints = { [N in keyof Endpoints as Endpoints[N]["path"] & string]: Endpoints[N]; };