nodejs / undici

An HTTP/1.1 client, written from scratch for Node.js
https://nodejs.github.io/undici
MIT License
6.08k stars 529 forks source link

undici/types/index.d.ts:21:8: Type error TS1192: Module '"undici@6.19.0/node_modules/undici/types/interceptors"' has no default export #3330

Closed btakita closed 3 months ago

btakita commented 3 months ago

Bug Description

After upgrading to v6.19.0. When running the check-dts program to verify the types. The following error occurs:

undici/types/index.d.ts:21:8: Type error TS1192
│   Module '"undici@6.19.0/node_modules/undici/types/interceptors"' has no default export

Reproducible By

Running check-dts

Expected Behavior

No Type error

Logs & Screenshots

Environment

Linux 6.9.4-arch1-1 x86_64 unknown

Node v22.3.0

Additional context

Here is the line causing the error: https://github.com/nodejs/undici/blob/main/types/index.d.ts#L21

Came from https://github.com/nodejs/undici/pull/3318

mcollina commented 3 months ago

Can you create a quick reproduction that we can run?

mcollina commented 3 months ago

(A PR with the fix is also fine)

metcoder95 commented 3 months ago

True, it has not default export; completely missed that, but wonder how the test passed: https://github.com/nodejs/undici/blob/981fb3d72a4393f77c9f28e3ea2f77dc4cf6e9ad/types/interceptors.d.ts#L4-L11

btakita commented 3 months ago

@metcoder95 I use the check-dts package to verify the types. Typescript acts unpredictably at times with type verifications. At times, I have seen types fail in a dependent package's tests.

Perhaps importing some types in a *.test.ts module would help?

metcoder95 commented 3 months ago

It could be useful sure, do you want to send a PR for it?

Uzlopak commented 3 months ago

provided PR #3332