// export interface BaseNode { url: string, optionsAndHeaders: RequestInit } // export interface HasGet extends BaseNode { // get(query: TQuery): Promise; // } // export interface HasPost extends BaseNode { // post(data: TData): Promise; // } // export interface HasPut extends BaseNode { // put(data: TData): Promise; // } // export interface HasPatch extends BaseNode { // patch(data: TData): Promise; // } // export interface HasDelete extends BaseNode { // delete(): Promise; // } // export interface HasOptions extends BaseNode { // options(): Promise; // } // // export interface HasAll extends HasGet, HasPost, HasPut, HasPatch, HasDelete, HasOptions{ // } // // export type Diff = T extends U ? never : T; // Remove types from T that are assignable to U // export type Filter = T extends U ? T : never; // Remove types from T that are not assignable to U // // export type RemoveVerbs = Diff // // export type AnyFunction = (...args: any[]) => any; // export type ReturnType = // T extends (...args: any[]) => infer R // ? R // : never; // // export const GET = "GET" // export const POST = "POST" // export const PUT = "PUT" // export const PATCH = "PATCH" // export const DELETE = "DELETE" // export type Verb = "GET" | "POST" | "PUT" | "DELETE" | "OPTIONS" | "PATCH"; // export type Struct = { $id: Struct } | { [resource:string]: Struct } | Verb[] | true; // export type AddGetVerb = V extends "GET"[] ? HasGet : unknown; // export type AddPostVerb = V extends "POST"[] ? HasPost : unknown; // export type AddPutVerb = V extends "PUT"[] ? HasPut : unknown; // export type AddDeleteVerb = V extends "DELETE"[] ? HasDelete : unknown; // export type AddPatchVerb = V extends "PATCH"[] ? HasPatch : unknown; // export type AddOptionsVerb = V extends "OPTIONS"[] ? HasOptions : unknown; // export type InterfaceForVerbs = // AddGetVerb & AddPostVerb & AddPutVerb & AddDeleteVerb & AddPatchVerb & AddOptionsVerb // // export type ApiInterface = // T extends true ? HasAll : // T extends Verb[] ? InterfaceForVerbs : unknown; // // export type ApiIdFunction = // T extends { $id: Struct } ? // (id: string) => Api & { $id: (id: string) => Api }: // unknown // // export type ApiChildren = // { [K in keyof T]: Api }; // // export type Api = // ApiInterface & ApiChildren & ApiIdFunction // // export function makeApi(struct: T): Api { // throw ""; // } // // let struct: Struct = { // people: { // ...[GET,POST], // $id: { // ...[GET,PUT,DELETE], // address: [GET, POST, PUT] // } // } // } // // let api = makeApi(struct); // // api.people('a').address;