-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client excessive routes #2200
base: master
Are you sure you want to change the base?
Client excessive routes #2200
Conversation
I've got another idea... type PathsForMethod<M extends Method> = keyof Response extends `${M} ${infer U}` ? U : never; |
I'm still struggling to figure out what exactly it should be. I need to decide on the goal:
For type error it must be another input, like OctoKit — combines method+path. I see no other neat way. can be like that // rm extends from Input and Response
// this one changes to retain original behavior
export type Provider = <M extends Method, P extends Path>(
method: M,
path: P,
params: `${M} ${P}` extends keyof Input ? Input[`${M} ${P}`] : Record<string, any>,
) => Promise<`${M} ${P}` extends keyof Response ? Response[`${M} ${P}`] : any>;
// this one new:
export type StrictProvider = <K extends keyof Input>(
request: K,
params: Input[K]
) => Promise<Response[K]>; |
Address #2182 and #2183