Skip to content

Commit

Permalink
feat: upgrade openapi-typescript-helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Aug 24, 2024
1 parent 2e5393a commit fb620f2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"defu": "^6.1.4",
"ofetch": "^1.3.4",
"ohash": "^1.1.3",
"openapi-typescript-helpers": "0.0.11",
"openapi-typescript-helpers": "0.0.12",
"pathe": "^1.1.2",
"scule": "^1.3.0",
"ufo": "^1.5.4"
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions src/runtime/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
MediaType,
OperationRequestBodyContent,
ResponseObjectMap,
IsOperationRequestBodyOptional,
SuccessResponse,
} from 'openapi-typescript-helpers'

Expand All @@ -15,14 +16,15 @@ export type FetchResponseError<T> = NuxtError<ErrorResponse<ResponseObjectMap<T>
export type MethodOption<M, P> = 'get' extends keyof P ? { method?: M } : { method: M }

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type ParamsOption<T> = T extends { parameters?: any, query?: any } ? T['parameters'] : unknown
export type ParamsOption<T> = T extends { parameters?: any, query?: any }
? T['parameters']
: Record<string, unknown>

export type RequestBodyOption<T> =
OperationRequestBodyContent<T> extends never
? { body?: never }
: undefined extends OperationRequestBodyContent<T>
? { body?: OperationRequestBodyContent<T> }
: { body: OperationRequestBodyContent<T> }
export type RequestBodyOption<T> = OperationRequestBodyContent<T> extends never
? { body?: never }
: IsOperationRequestBodyOptional<T> extends true
? { body?: OperationRequestBodyContent<T> }
: { body: OperationRequestBodyContent<T> }

export type FilterMethods<T> = {
[K in keyof Omit<T, 'parameters'> as T[K] extends never | undefined
Expand Down

0 comments on commit fb620f2

Please sign in to comment.