Defjs
Core

createClient

Creates a Defjs DerivableClient from option helpers.

@defjs/core · Function

Signature

function createClient(...options: ClientOption[]): DerivableClient;

Options apply in order: a later option overwrites an earlier one for the same setting, and interceptors accumulate. Prefer creating the client inside the request boundary when interceptors close over auth or tenants. Default HTTP/SSE fetch availability is checked when an operation invokes transport.

The returned factory is a function. Calling it with RequestOptions returns a Client value for one call and performs no I/O; see DerivableClient for the snapshot rules. The factory itself is also a Client and carries no request options, so it can be passed to an operation directly. The base configuration is shared by every client value and is not frozen at runtime. It is fixed by convention: nothing in the library changes it, and applications should not either.

Parameters

Prop

Type

...options? ClientOption[]

Client option helpers such as withEndpoint.

Returns

A callable factory that carries the resolved base configuration.

Examples

import { createClient, withEndpoint } from "@defjs/core";

const client = createClient(withEndpoint("https://api.example.com"));
Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao