We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm writing in hopes of getting some help.
I would like to know if it is possible to have a scenario like this one:
interface Paths { '/api/pet': { 'get' :{}, }, '/api/store': { 'get' :{}, }, '/api/pet/{id}': { 'post': {}, }, '/api/store/{id}': { 'post': {}, }, }; type Methods = 'get' | 'post' | 'put' | 'delete' ; type PathKeysWithMethod<Paths, TMethod extends Methods> = SomeUtils<Paths, "Some condition here"> ; const pathOfGetMethod: PathKeysWithMethod<'get', Paths> // expect '/api/pet', '/api/store' const pathOfPostMethod: PathKeysWithMethod<'post', Paths> // expect '/api/pet/{id}', '/api/store/{id}'
i tried
type PathKeysWithMethod<Paths , TMethod extends Methods> = StringKeyOf< ConditionalPickDeep<Paths, Record<TMethod, unknown>>; const pathOfPostMethod: PathKeysWithMethod<'post', Paths> // result '/api/pet', '/api/store', '/api/pet/{id}', '/api/store/{id}', //expected '/api/pet/{id}', '/api/store/{id}'
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm writing in hopes of getting some help.
I would like to know if it is possible to have a scenario like this one:
i tried
The text was updated successfully, but these errors were encountered: