Skip to content

Commit

Permalink
Fix wrong extends logic for ValidUserParams (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
0237h authored May 29, 2024
1 parent 6c3fe98 commit 2a26704
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type EndpointParameters<E extends keyof GetEndpoints> = z.infer<GetEndpoi
export type UsageEndpoints = Exclude<keyof GetEndpoints, "/health" | "/metrics" | "/version" | "/openapi">;
export type UsageResponse = z.infer<GetEndpoints[UsageEndpoints]["response"]>;

export type ValidUserParams<E extends UsageEndpoints> = { path: unknown; } extends EndpointParameters<E> ?
export type ValidUserParams<E extends UsageEndpoints> = EndpointParameters<E> extends { path: unknown; } ?
// Combine path and query parameters only if path exists to prevent "never" on intersection
Extract<EndpointParameters<E>, { query: unknown; }>["query"] & Extract<EndpointParameters<E>, { path: unknown; }>["path"]
:
Expand Down

0 comments on commit 2a26704

Please sign in to comment.