Closed giulianovarriale closed 2 years ago
Hey @giulianovarriale,
Hello. First, thanks for creating this package. Awesome job!
Thanks! π
Am I doing something wrong or the type inference is not properly working for this block?
Nope, you are not doing anything wrong π. Type inference for "thenable" functions was notoriously hard when wretch
was written, several years ago.
But now, with typescript 4.5+ and the introduction of the Awaited
helper it is way easier.
I just released a new version which improves the types for .res
and other parser methods, which should now properly type the sample you posted.
Feel free to reopen otherwise, and thanks for reporting the issue in the first place π.
Wow, that was a quick response and fix! Nice. I will check if everything works properly. Thanks for sharing about the new API from typescript btw. Very handy.
Hello. First, thanks for creating this package. Awesome job!
I was creating a service to perform a request and based on the success status, do something else. Here is a pseudo code that simulates what I'm doing:
For some reason, I'm not able to proper type the
.res
block. With the code above, I get the following error:I've tried setting the type in many different ways but I can't get ride of the error. Am I doing something wrong or the type inference is not properly working for this block?