You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I really love using ofetch because it's very powerful and covers almost all use cases.
The one feature that is missing for me is type annotatations. I believe this could be automated using tools like openapi-typescript, which can generate TS-types based on OpenAPI specification.
So what I mean is:
// import types auto-generated from the OpenAPI spec// they're generated by openapi-typescriptimporttype{paths}from'./autogenerated-types/my-api';constmyApiFetch=ofetch.create<paths>(options)// provide paths as generic to ofetch.create// intellisense for request URL, method, body, etc.myApiFetch('/endpoint',{method: 'POST',body: {}})
The openapi-typescript has its own package called openapi-fetch with support of this feature, but since ofetch is great integrated into Nuxt 3, it would be very nice to also have this possibility here. And ofetch has more features than the openapi-fetch.
Additional information
Would you be willing to help implement this feature?
The text was updated successfully, but these errors were encountered:
Describe the feature
Hi everyone!
I really love using ofetch because it's very powerful and covers almost all use cases.
The one feature that is missing for me is type annotatations. I believe this could be automated using tools like openapi-typescript, which can generate TS-types based on OpenAPI specification.
So what I mean is:
The
openapi-typescript
has its own package calledopenapi-fetch
with support of this feature, but sinceofetch
is great integrated into Nuxt 3, it would be very nice to also have this possibility here. Andofetch
has more features than theopenapi-fetch
.Additional information
The text was updated successfully, but these errors were encountered: