unjs / nitro

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

fix(types): infer types correctly when method is omitted #2550

Closed danielroe closed 3 months ago

danielroe commented 3 months ago

๐Ÿ”— Linked issue

โ“ Type of change

๐Ÿ“š Description

Not sure when it was introduced, but at some point there was a regression in the types for $fetch when a method is omitted. Previously, the get method was selected, but now a union of all possible endpoints is provided.

This is the remaining issue blocking types in https://github.com/nuxt/nuxt/pull/27702.

This PR adds a type test - I plan to update when the fix is found.

cc: @pi0

๐Ÿ“ Checklist

pi0 commented 3 months ago

https://github.com/unjs/nitro/commit/9a71720396ca1c7af804a1ec588732aa78ae1a21