Entry points
Find which entry point exports what, and the reference page that lists it.
The reference lists every export of Effetch, grouped by the guide that covers it. Start here to find which import a name comes from, then follow the link to its page.
The entry points
Effetch has three entry points, each with its own reference page:
| Import | What it exports | Reference |
|---|---|---|
@monarcode/effetch | The Fetch namespace: clients, calls, responses, uploads, errors, plugins, endpoint definitions, streaming and pagination | Fetch |
@monarcode/effetch/plugins | The built-in plugins (bearer, retry, timeout, logger and consoleLogger), their option and plugin types, and TimeoutError | Plugins |
@monarcode/effetch/test | The FetchTest namespace: a fake backend for tests, and the requests it records | FetchTest |
Each reference entry gives the first paragraph of the name's docs, plus what it needs and how it fails. Your editor shows the full docs, with an example, when you hover a name or go to its definition.
Two more subpaths, @monarcode/effetch/Fetch and
@monarcode/effetch/test/FetchTest, export the same members without the
namespace. They exist for the declaration files TypeScript writes, so you
may see them in a .d.ts file. In your own code, import from the three
entry points in the table, as Installation
shows.
Types for your own functions
When you wrap a call in a function of your own, you can name its return
type with Fetch.CallEffect. It takes the output schema, the error body
schema, the input schema and the client's plugins, and works out the
call's errors and services from them:
import * as from "effect/Schema";
import type { } from "@monarcode/effetch";
declare const : .;
const = .({ : ., : . });
type = .<typeof , ., undefined, []>;
export const = (: number): =>
.("/todos/:id", { : { }, : });The option types, such as Fetch.RequestOptions, are under
Calls in the Fetch reference. To take a
call as an argument instead, accept any Effect.Effect<A, E, R>, since
TypeScript can't infer CallEffect's parameters from a call.
What's next
- Fetch: look up a member of the
Fetchnamespace. - Compatibility: check the Effect, runtime and TypeScript versions Effetch supports.
- Limitations: check the known limits of paths, plugins and streams before you rely on them.