Skip to content

'interceptors' export doesn't work like in the docs #3308

@jrr

Description

@jrr

Bug Description

I'm trying to use the built-in retry interceptor, like in this docs example:

const { Client, interceptors } = require("undici");
const { retry } = interceptors;
error TS2614: Module '"undici"' has no exported member 'interceptors'. Did you mean to use 'import interceptors from "undici"' instead?

import { Client, interceptors } from "undici";
                 ~~~~~~~~~~~~

Following TypeScript's suggestion, this seems to work:

import { Client } from "undici";
import undici from "undici";
const { interceptors } = undici;
const { retry } = interceptors;

That's a decent workaround for now, but it'd be great if the export could work as the doc describes.

Using undici v6.18.2, the latest as of this writing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TypesChanges related to the TypeScript definitionsbugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions