Skip to content

Commit

Permalink
fix/typescript: options of schemas without parameters resolve to Reco…
Browse files Browse the repository at this point in the history
…rd<string, never> (#77)

The type `Record<string, never>` blanks out all keys when combined with other types via `&`. Type composition ignores the `unknown` type.
  • Loading branch information
mattmess1221 authored Jun 18, 2024
1 parent ab30c8d commit a92bd9d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/runtime/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type FetchResponseError<T> = NuxtError<
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'] : Record<string, never>
export type ParamsOption<T> = T extends { parameters?: any, query?: any } ? T['parameters'] : unknown

export type RequestBodyOption<T> =
OperationRequestBodyContent<T> extends never
Expand Down

0 comments on commit a92bd9d

Please sign in to comment.