developit / redaxios

The Axios API, as an 800 byte Fetch wrapper.
https://npm.im/redaxios
Apache License 2.0
4.72k stars 100 forks source link

return type of `create` cannot be named #83

Open tamird opened 2 years ago

tamird commented 2 years ago

https://github.com/developit/redaxios/blob/1c2d5846d0a2172e5dd77366a836404f6ce8f71e/src/index.js#L70

redaxios is not defined anywhere, so it cannot be used downstream. That is, it is impossible to define a function that takes the return type of create as a parameter.

tamird commented 2 years ago

Ah, I misunderstood - the problem is also that create is not exported at all, so it is not possible to create multiple clients.

EDIT: it is exported as redaxios.create, but the type is still unnameable.

tamird commented 2 years ago

Ah, it's possible to work around this by writing {typeof redaxios.default} in the jsdoc comment.