nitrojs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.build
MIT License
6.16k stars 507 forks source link

Better typed fetch #2758

Open pi0 opened 1 month ago

pi0 commented 1 month ago

Context, work, and explanation by @danielroe: https://github.com/unjs/nitro/pull/1532

We are thinking of improving (auto-generated) typed fetch. This requires adopting a new standard/reusable type utility for fetch, which @danielroe is working on. By using the new layer, we can improve performance and consistency and adopt it in several places instead of directly being in nitro core (benefiting nuxt, and in next steps ofetch and h3 typed fetch support.)

ImBoop commented 1 month ago

Improving fetch types would be an immense QOL improvement. I for one am very excited about this and am looking forward to more info as y'all push forward with it.

NothingEverWorks commented 1 month ago

Will this also type readBody to match the json serialization similiar to https://github.com/unjs/nitro/pull/1002?

image

And will this support alternative serializer to maintain type safety similiar to https://nuxt.com/docs/getting-started/data-fetching#using-an-alternative-serializer?

ImBoop commented 1 week ago

Is this still planned? To my knowledge, it's one of the things gating Nuxt 4