import restRequest from "./restRequest"; import {OrmGenerics} from "../types/ormGenerics"; import {iRest, iRestMethods} from "../types/ormInterfaces"; type WithMethod, M extends iRestMethods> = Omit & { RequestMethod: M }; export function restOrm>( configFn: () => Omit, "requestMethod"> ) { return { Get: restRequest>(() => ({ ...configFn(), requestMethod: "GET" })), Put: restRequest>(() => ({ ...configFn(), requestMethod: "PUT" })), Post: restRequest>(() => ({ ...configFn(), requestMethod: "POST" })), Delete: restRequest>(() => ({ ...configFn(), requestMethod: "DELETE" })) }; }