Replies: 2 comments 2 replies
-
In general it’s tough to recreate the full path without redoing all the work from scratch (and possibly accidentally diverging on one step) Since you have the export function useGet(path: Parameters<typeof client.GET>[0], init: Parameters<typeof client.GET>[1]) { Avoid specifying a return type if you can help it; the inference should just work correctly and save you from having to do work. |
Beta Was this translation helpful? Give feedback.
2 replies
-
For those still looking for a solution, with // Import from your *.d.ts-export from openapi-typescript
import { paths } from "./schema";
type AllPaths = keyof paths; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm really liking
openapi-typescript
andopenapi-fetch
so far, but I've run into a bit of an issue trying to add Vue reactivity around requests. Disclaimer: I'm by no means a Typescript meta programming expert.If anyone could give me some pointers on how to get the right type for
path
and then the return type for the data in the success case it would be much appreciated.I've looked at the
openapi-fetch
code: https://github.com/drwpow/openapi-typescript/blob/main/packages/openapi-fetch/src/index.ts#L91Just extracting what I saw there didn't seem to work:
Neither did:
Beta Was this translation helpful? Give feedback.
All reactions