@hyper-fetch/core
Version:
Cache, Queue and Persist your requests no matter if you are online or offline!
14 lines (11 loc) • 615 B
text/typescript
import { TypeWithDefaults } from "types";
import { Client, ClientErrorType, ClientOptionsType } from "client";
import { HttpAdapterType } from "http-adapter";
export type ClientGenericType = {
error?: ClientErrorType;
};
export function createClient<ClientProperties extends ClientGenericType = {}>(
options: ClientOptionsType<Client<NonNullable<TypeWithDefaults<ClientProperties, "error", Error>>>>,
): Client<NonNullable<TypeWithDefaults<ClientProperties, "error", Error>>, HttpAdapterType> {
return new Client<NonNullable<TypeWithDefaults<ClientProperties, "error", Error>>, HttpAdapterType>(options);
}