UNPKG

@hyper-fetch/core

Version:

Cache, Queue and Persist your requests no matter if you are online or offline!

15 lines (12 loc) 655 B
import type { TypeWithDefaults } from "types"; import type { ClientErrorType, ClientOptionsType } from "client"; import { Client } from "client"; import type { 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); }