Skip to content

Commit afc4a34

Browse files
Fix PathMethod object types
1 parent b0d2bb2 commit afc4a34

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

+4-5
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,16 @@ 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 */
173-
export type MaybeOptionalInit<
174-
P extends Record<HttpMethod, {}>,
175-
M extends keyof P,
176-
> =
175+
export type MaybeOptionalInit<P extends PathMethods, M extends keyof P> =
177176
HasRequiredKeys<FetchOptions<FilterKeys<P, M>>> extends never
178177
? [(FetchOptions<FilterKeys<P, M>> | undefined)?]
179178
: [FetchOptions<FilterKeys<P, M>>];
180179

181180
export type ClientMethod<
182-
Paths extends Record<string, Record<HttpMethod, {}>>,
181+
Paths extends Record<string, PathMethods>,
183182
M extends HttpMethod,
184183
> = <
185184
P extends PathsWithMethod<Paths, M>,

0 commit comments

Comments
 (0)