Currently many of the exported types are any or very weakly typed.
It would be great if these types could be properly populated via the jsdoc.
For example, the various places you can pass options tend to accept any even though we have a strong type for the user options already.
I did actually start doing this but the overloads you have lead to a lot of craziness in the types.
For example, if we strongly type the overloads of resolve, the tests fail to compile because there are some which explicitly pass in undefined to ensure an error is thrown rather than bailing.
These tests make perfect sense but mean we end up having to dumb down the types to signatures nobody should ever really use. Alternatively we can double-cast undefined via jsdoc (to unknown then to string).
Similarly, the various overloads lead to all sorts of funky types, but are ultimately doable at least.
Maybe if i at least put a draft pr up, you can see what i mean.
cc @sokra maybe if you can list the "officially supported" overloads, that'd help us write the correct types
Currently many of the exported types are
anyor very weakly typed.It would be great if these types could be properly populated via the jsdoc.
For example, the various places you can pass options tend to accept
anyeven though we have a strong type for the user options already.I did actually start doing this but the overloads you have lead to a lot of craziness in the types.
For example, if we strongly type the overloads of
resolve, the tests fail to compile because there are some which explicitly pass inundefinedto ensure an error is thrown rather than bailing.These tests make perfect sense but mean we end up having to dumb down the types to signatures nobody should ever really use. Alternatively we can double-cast undefined via jsdoc (to
unknownthen tostring).Similarly, the various overloads lead to all sorts of funky types, but are ultimately doable at least.
Maybe if i at least put a draft pr up, you can see what i mean.
cc @sokra maybe if you can list the "officially supported" overloads, that'd help us write the correct types