Closed jinbe closed 1 month ago
Hello, I have done a huge rewrite for the library, Let me know if it picks it up now.
The easiest way for the library to pick up the return type is to assign it to a "result" or "results" variable, otherwise it will try to pick it up automatically.
Please try with the latest version npx svetch.ts@latest
and let me know
Closing this, Added a lot more detection mechanisms, whenever it's not able to detect it, the easiest solution is to assign the final result to a results const, then return that.
It will infer from that.
If there is a specific thing not being picked up, feel free to reopen and I'll try my best.
Return statements in nested functions such as:
Promise.then(result => { return result; });
or something like this (kysley)
Causes the generator to detect an error with a return statement not returning json or new Response().
Additionally if you had a function you call to generate a response. The return type of this function is not evaluated so that it can be validated against a valid json() or Response object.
E.g.