Skip to content

undici installed in a TypeScript project errors with ...types/client.d.ts:5:33 - error TS2307: Cannot find module 'abort-controller' or its corresponding type declarations. #480

@Jolg42

Description

@Jolg42

When updgrading from 2.1.1 to 2.2.0 I got this error in TypeScript:

> tsc -d

../../node_modules/.pnpm/undici@2.2.0/node_modules/undici/types/client.d.ts:5:33 - error TS2307: Cannot find module 'abort-controller' or its corresponding type declarations.

5 import { AbortController } from 'abort-controller'
                                  ~~~~~~~~~~~~~~~~~~

Found 1 error.

The source should be this line https://github.com/nodejs/undici/blob/master/types/client.d.ts#L5

So here the abort-controller package is missing and because TypeScript cannot find it, it errors.
Meaning that it needs to be installed / be a required dependency.

I added the package as a dev dependency in my project and it worked 😃

Maybe this would need to be documented or the dependency required? (Note: I am not using abort-controller functionality here).

Note: Many Thanks for the types! 💚

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions