Skip to content

Commit cb90212

Browse files
Fix PathMethod object types
1 parent b0d2bb2 commit cb90212

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/openapi-fetch/src/index.d.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,19 @@ export interface Middleware {
169169
onResponse?: typeof onResponse;
170170
}
171171

172+
type PathMethods = Partial<Record<HttpMethod, {}>>;
173+
172174
/** This type helper makes the 2nd function param required if params/requestBody are required; otherwise, optional */
173175
export type MaybeOptionalInit<
174-
P extends Record<HttpMethod, {}>,
176+
P extends PathMethods,
175177
M extends keyof P,
176178
> =
177179
HasRequiredKeys<FetchOptions<FilterKeys<P, M>>> extends never
178180
? [(FetchOptions<FilterKeys<P, M>> | undefined)?]
179181
: [FetchOptions<FilterKeys<P, M>>];
180182

181183
export type ClientMethod<
182-
Paths extends Record<string, Record<HttpMethod, {}>>,
184+
Paths extends Record<string, PathMethods>,
183185
M extends HttpMethod,
184186
> = <
185187
P extends PathsWithMethod<Paths, M>,

0 commit comments

Comments
 (0)