Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup of TypeScript types, removal of returnType and removal of any. #729

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/five-rabbits-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kubb/swagger-tanstack-query": patch
---

Cleanup of TypeScript types, removal of returnType and removal of any.
1 change: 0 additions & 1 deletion e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"sourceMap": true,
"strictNullChecks": true,
"jsx": "react-jsx",
"declaration": true,
"outDir": "es",
"experimentalDecorators": true,
"skipLibCheck": true,
Expand Down
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default [
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'unused-imports/no-unused-vars': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,21 @@
headerParams: never
response: Awaited<ReturnType<FindPetsByStatusClient>>
client: {
parameters: Partial<Parameters<FindPetsByStatusClient>[0]>

Check warning on line 16 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts#L16

Added line #L16 was not covered by tests
return: Awaited<ReturnType<FindPetsByStatusClient>>
}
}
export const findPetsByStatusQueryKey = (params?: FindPetsByStatus['queryParams']) => [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const
export type FindPetsByStatusQueryKey = ReturnType<typeof findPetsByStatusQueryKey>
export function findPetsByStatusQueryOptions<
TQueryFnData extends FindPetsByStatus['data'] = FindPetsByStatus['data'],
TError = FindPetsByStatus['error'],
TData = FindPetsByStatus['response'],
TQueryData = FindPetsByStatus['response'],
>(
export function findPetsByStatusQueryOptions<TData = FindPetsByStatus['response'], TQueryData = FindPetsByStatus['response']>(

Check warning on line 22 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts#L22

Added line #L22 was not covered by tests
params?: FindPetsByStatus['queryParams'],
options: FindPetsByStatus['client']['parameters'] = {},
): WithRequired<UseBaseQueryOptions<FindPetsByStatus['response'], TError, TData, TQueryData>, 'queryKey'> {
): WithRequired<UseBaseQueryOptions<FindPetsByStatus['response'], FindPetsByStatus['error'], TData, TQueryData>, 'queryKey'> {

Check warning on line 25 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts#L24-L25

Added lines #L24 - L25 were not covered by tests
const queryKey = findPetsByStatusQueryKey(params)
return {
queryKey,
queryFn: async () => {
const res = await client<TQueryFnData, TError>({
const res = await client<FindPetsByStatus['data'], FindPetsByStatus['error']>({

Check warning on line 30 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts#L30

Added line #L30 was not covered by tests
method: 'get',
url: `/pet/findByStatus`,
params,
Expand All @@ -47,24 +42,22 @@
* @summary Finds Pets by status
* @link /pet/findByStatus */
export function useFindPetsByStatus<
TQueryFnData extends FindPetsByStatus['data'] = FindPetsByStatus['data'],
TError = FindPetsByStatus['error'],
TData = FindPetsByStatus['response'],
TQueryData = FindPetsByStatus['response'],
TQueryKey extends QueryKey = FindPetsByStatusQueryKey,
>(params?: FindPetsByStatus['queryParams'], options: {
query?: UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>
query?: UseBaseQueryOptions<FindPetsByStatus['data'], FindPetsByStatus['error'], TData, TQueryData, TQueryKey>
client?: FindPetsByStatus['client']['parameters']
} = {}): UseQueryResult<TData, TError> & {
} = {}): UseQueryResult<TData, FindPetsByStatus['error']> & {

Check warning on line 51 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts#L49-L51

Added lines #L49 - L51 were not covered by tests
queryKey: TQueryKey
} {
const { query: queryOptions, client: clientOptions = {} } = options ?? {}
const queryKey = queryOptions?.queryKey ?? findPetsByStatusQueryKey(params)
const query = useQuery<TQueryFnData, TError, TData, any>({
...findPetsByStatusQueryOptions<TQueryFnData, TError, TData, TQueryData>(params, clientOptions),
const query = useQuery<FindPetsByStatus['data'], FindPetsByStatus['error'], TData, any>({
...findPetsByStatusQueryOptions<TData, TQueryData>(params, clientOptions),

Check warning on line 57 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts#L56-L57

Added lines #L56 - L57 were not covered by tests
queryKey,
...queryOptions,
}) as UseQueryResult<TData, TError> & {
}) as UseQueryResult<TData, FindPetsByStatus['error']> & {

Check warning on line 60 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts#L60

Added line #L60 was not covered by tests
queryKey: TQueryKey
}
query.queryKey = queryKey as TQueryKey
Expand All @@ -73,20 +66,15 @@
export const findPetsByStatusInfiniteQueryKey = (params?: FindPetsByStatus['queryParams']) =>
[{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const
export type FindPetsByStatusInfiniteQueryKey = ReturnType<typeof findPetsByStatusInfiniteQueryKey>
export function findPetsByStatusInfiniteQueryOptions<
TQueryFnData extends FindPetsByStatus['data'] = FindPetsByStatus['data'],
TError = FindPetsByStatus['error'],
TData = FindPetsByStatus['response'],
TQueryData = FindPetsByStatus['response'],
>(
export function findPetsByStatusInfiniteQueryOptions<TData = FindPetsByStatus['response'], TQueryData = FindPetsByStatus['response']>(

Check warning on line 69 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts#L69

Added line #L69 was not covered by tests
params?: FindPetsByStatus['queryParams'],
options: FindPetsByStatus['client']['parameters'] = {},
): WithRequired<UseInfiniteQueryOptions<FindPetsByStatus['response'], TError, TData, TQueryData>, 'queryKey'> {
): WithRequired<UseInfiniteQueryOptions<FindPetsByStatus['response'], FindPetsByStatus['error'], TData, TQueryData>, 'queryKey'> {

Check warning on line 72 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts#L71-L72

Added lines #L71 - L72 were not covered by tests
const queryKey = findPetsByStatusInfiniteQueryKey(params)
return {
queryKey,
queryFn: async ({ pageParam }) => {
const res = await client<TQueryFnData, TError>({
const res = await client<FindPetsByStatus['data'], FindPetsByStatus['error']>({

Check warning on line 77 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts#L77

Added line #L77 was not covered by tests
method: 'get',
url: `/pet/findByStatus`,
...options,
Expand All @@ -105,24 +93,22 @@
* @summary Finds Pets by status
* @link /pet/findByStatus */
export function useFindPetsByStatusInfinite<
TQueryFnData extends FindPetsByStatus['data'] = FindPetsByStatus['data'],
TError = FindPetsByStatus['error'],
TData = FindPetsByStatus['response'],
TQueryData = FindPetsByStatus['response'],
TQueryKey extends QueryKey = FindPetsByStatusInfiniteQueryKey,
>(params?: FindPetsByStatus['queryParams'], options: {
query?: UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>
query?: UseInfiniteQueryOptions<FindPetsByStatus['data'], FindPetsByStatus['error'], TData, TQueryData, TQueryKey>
client?: FindPetsByStatus['client']['parameters']
} = {}): UseInfiniteQueryResult<TData, TError> & {
} = {}): UseInfiniteQueryResult<TData, FindPetsByStatus['error']> & {

Check warning on line 102 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts#L100-L102

Added lines #L100 - L102 were not covered by tests
queryKey: TQueryKey
} {
const { query: queryOptions, client: clientOptions = {} } = options ?? {}
const queryKey = queryOptions?.queryKey ?? findPetsByStatusInfiniteQueryKey(params)
const query = useInfiniteQuery<TQueryFnData, TError, TData, any>({
...findPetsByStatusInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryData>(params, clientOptions),
const query = useInfiniteQuery<FindPetsByStatus['data'], FindPetsByStatus['error'], TData, any>({
...findPetsByStatusInfiniteQueryOptions<TData, TQueryData>(params, clientOptions),

Check warning on line 108 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts#L107-L108

Added lines #L107 - L108 were not covered by tests
queryKey,
...queryOptions,
}) as UseInfiniteQueryResult<TData, TError> & {
}) as UseInfiniteQueryResult<TData, FindPetsByStatus['error']> & {

Check warning on line 111 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts#L111

Added line #L111 was not covered by tests
queryKey: TQueryKey
}
query.queryKey = queryKey as TQueryKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,22 @@
headerParams: FindPetsByTagsHeaderParams
response: Awaited<ReturnType<FindPetsByTagsClient>>
client: {
parameters: Partial<Parameters<FindPetsByTagsClient>[0]>

Check warning on line 21 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts#L21

Added line #L21 was not covered by tests
return: Awaited<ReturnType<FindPetsByTagsClient>>
}
}
export const findPetsByTagsQueryKey = (params?: FindPetsByTags['queryParams']) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
export function findPetsByTagsQueryOptions<
TQueryFnData extends FindPetsByTags['data'] = FindPetsByTags['data'],
TError = FindPetsByTags['error'],
TData = FindPetsByTags['response'],
TQueryData = FindPetsByTags['response'],
>(
export function findPetsByTagsQueryOptions<TData = FindPetsByTags['response'], TQueryData = FindPetsByTags['response']>(

Check warning on line 27 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts#L27

Added line #L27 was not covered by tests
headers: FindPetsByTags['headerParams'],
params?: FindPetsByTags['queryParams'],
options: FindPetsByTags['client']['parameters'] = {},
): WithRequired<UseBaseQueryOptions<FindPetsByTags['response'], TError, TData, TQueryData>, 'queryKey'> {
): WithRequired<UseBaseQueryOptions<FindPetsByTags['response'], FindPetsByTags['error'], TData, TQueryData>, 'queryKey'> {

Check warning on line 31 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts#L30-L31

Added lines #L30 - L31 were not covered by tests
const queryKey = findPetsByTagsQueryKey(params)
return {
queryKey,
queryFn: async () => {
const res = await client<TQueryFnData, TError>({
const res = await client<FindPetsByTags['data'], FindPetsByTags['error']>({

Check warning on line 36 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts#L36

Added line #L36 was not covered by tests
method: 'get',
url: `/pet/findByTags`,
params,
Expand All @@ -54,46 +49,39 @@
* @summary Finds Pets by tags
* @link /pet/findByTags */
export function useFindPetsByTags<
TQueryFnData extends FindPetsByTags['data'] = FindPetsByTags['data'],
TError = FindPetsByTags['error'],
TData = FindPetsByTags['response'],
TQueryData = FindPetsByTags['response'],
TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
>(headers: FindPetsByTags['headerParams'], params?: FindPetsByTags['queryParams'], options: {
query?: UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>
query?: UseBaseQueryOptions<FindPetsByTags['data'], FindPetsByTags['error'], TData, TQueryData, TQueryKey>
client?: FindPetsByTags['client']['parameters']
} = {}): UseQueryResult<TData, TError> & {
} = {}): UseQueryResult<TData, FindPetsByTags['error']> & {

Check warning on line 58 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts#L56-L58

Added lines #L56 - L58 were not covered by tests
queryKey: TQueryKey
} {
const { query: queryOptions, client: clientOptions = {} } = options ?? {}
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
const query = useQuery<TQueryFnData, TError, TData, any>({
...findPetsByTagsQueryOptions<TQueryFnData, TError, TData, TQueryData>(headers, params, clientOptions),
const query = useQuery<FindPetsByTags['data'], FindPetsByTags['error'], TData, any>({
...findPetsByTagsQueryOptions<TData, TQueryData>(headers, params, clientOptions),

Check warning on line 64 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts#L63-L64

Added lines #L63 - L64 were not covered by tests
queryKey,
...queryOptions,
}) as UseQueryResult<TData, TError> & {
}) as UseQueryResult<TData, FindPetsByTags['error']> & {

Check warning on line 67 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts#L67

Added line #L67 was not covered by tests
queryKey: TQueryKey
}
query.queryKey = queryKey as TQueryKey
return query
}
export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTags['queryParams']) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>
export function findPetsByTagsInfiniteQueryOptions<
TQueryFnData extends FindPetsByTags['data'] = FindPetsByTags['data'],
TError = FindPetsByTags['error'],
TData = FindPetsByTags['response'],
TQueryData = FindPetsByTags['response'],
>(
export function findPetsByTagsInfiniteQueryOptions<TData = FindPetsByTags['response'], TQueryData = FindPetsByTags['response']>(

Check warning on line 75 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts#L75

Added line #L75 was not covered by tests
headers: FindPetsByTags['headerParams'],
params?: FindPetsByTags['queryParams'],
options: FindPetsByTags['client']['parameters'] = {},
): WithRequired<UseInfiniteQueryOptions<FindPetsByTags['response'], TError, TData, TQueryData>, 'queryKey'> {
): WithRequired<UseInfiniteQueryOptions<FindPetsByTags['response'], FindPetsByTags['error'], TData, TQueryData>, 'queryKey'> {

Check warning on line 79 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts#L78-L79

Added lines #L78 - L79 were not covered by tests
const queryKey = findPetsByTagsInfiniteQueryKey(params)
return {
queryKey,
queryFn: async ({ pageParam }) => {
const res = await client<TQueryFnData, TError>({
const res = await client<FindPetsByTags['data'], FindPetsByTags['error']>({

Check warning on line 84 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts#L84

Added line #L84 was not covered by tests
method: 'get',
url: `/pet/findByTags`,
headers: { ...headers, ...options.headers },
Expand All @@ -113,24 +101,22 @@
* @summary Finds Pets by tags
* @link /pet/findByTags */
export function useFindPetsByTagsInfinite<
TQueryFnData extends FindPetsByTags['data'] = FindPetsByTags['data'],
TError = FindPetsByTags['error'],
TData = FindPetsByTags['response'],
TQueryData = FindPetsByTags['response'],
TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey,
>(headers: FindPetsByTags['headerParams'], params?: FindPetsByTags['queryParams'], options: {
query?: UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>
query?: UseInfiniteQueryOptions<FindPetsByTags['data'], FindPetsByTags['error'], TData, TQueryData, TQueryKey>
client?: FindPetsByTags['client']['parameters']
} = {}): UseInfiniteQueryResult<TData, TError> & {
} = {}): UseInfiniteQueryResult<TData, FindPetsByTags['error']> & {

Check warning on line 110 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts#L108-L110

Added lines #L108 - L110 were not covered by tests
queryKey: TQueryKey
} {
const { query: queryOptions, client: clientOptions = {} } = options ?? {}
const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params)
const query = useInfiniteQuery<TQueryFnData, TError, TData, any>({
...findPetsByTagsInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryData>(headers, params, clientOptions),
const query = useInfiniteQuery<FindPetsByTags['data'], FindPetsByTags['error'], TData, any>({
...findPetsByTagsInfiniteQueryOptions<TData, TQueryData>(headers, params, clientOptions),

Check warning on line 116 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts#L115-L116

Added lines #L115 - L116 were not covered by tests
queryKey,
...queryOptions,
}) as UseInfiniteQueryResult<TData, TError> & {
}) as UseInfiniteQueryResult<TData, FindPetsByTags['error']> & {

Check warning on line 119 in examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts#L119

Added line #L119 was not covered by tests
queryKey: TQueryKey
}
query.queryKey = queryKey as TQueryKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,21 @@
headerParams: never
response: Awaited<ReturnType<GetPetByIdClient>>
client: {
parameters: Partial<Parameters<GetPetByIdClient>[0]>

Check warning on line 16 in examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts#L16

Added line #L16 was not covered by tests
return: Awaited<ReturnType<GetPetByIdClient>>
}
}
export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [{ url: '/pet/:petId', params: { petId: petId } }] as const
export type GetPetByIdQueryKey = ReturnType<typeof getPetByIdQueryKey>
export function getPetByIdQueryOptions<
TQueryFnData extends GetPetById['data'] = GetPetById['data'],
TError = GetPetById['error'],
TData = GetPetById['response'],
TQueryData = GetPetById['response'],
>(
export function getPetByIdQueryOptions<TData = GetPetById['response'], TQueryData = GetPetById['response']>(

Check warning on line 22 in examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts#L22

Added line #L22 was not covered by tests
petId: GetPetByIdPathParams['petId'],
options: GetPetById['client']['parameters'] = {},
): WithRequired<UseBaseQueryOptions<GetPetById['response'], TError, TData, TQueryData>, 'queryKey'> {
): WithRequired<UseBaseQueryOptions<GetPetById['response'], GetPetById['error'], TData, TQueryData>, 'queryKey'> {

Check warning on line 25 in examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts#L24-L25

Added lines #L24 - L25 were not covered by tests
const queryKey = getPetByIdQueryKey(petId)
return {
queryKey,
queryFn: async () => {
const res = await client<TQueryFnData, TError>({
const res = await client<GetPetById['data'], GetPetById['error']>({

Check warning on line 30 in examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts#L30

Added line #L30 was not covered by tests
method: 'get',
url: `/pet/${petId}`,
...options,
Expand All @@ -45,46 +40,38 @@
* @description Returns a single pet
* @summary Find pet by ID
* @link /pet/:petId */
export function useGetPetById<
TQueryFnData extends GetPetById['data'] = GetPetById['data'],
TError = GetPetById['error'],
TData = GetPetById['response'],
TQueryData = GetPetById['response'],
TQueryKey extends QueryKey = GetPetByIdQueryKey,
>(petId: GetPetByIdPathParams['petId'], options: {
query?: UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>
client?: GetPetById['client']['parameters']
} = {}): UseQueryResult<TData, TError> & {
export function useGetPetById<TData = GetPetById['response'], TQueryData = GetPetById['response'], TQueryKey extends QueryKey = GetPetByIdQueryKey>(
petId: GetPetByIdPathParams['petId'],
options: {
query?: UseBaseQueryOptions<GetPetById['data'], GetPetById['error'], TData, TQueryData, TQueryKey>
client?: GetPetById['client']['parameters']
} = {},
): UseQueryResult<TData, GetPetById['error']> & {

Check warning on line 49 in examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts#L43-L49

Added lines #L43 - L49 were not covered by tests
queryKey: TQueryKey
} {
const { query: queryOptions, client: clientOptions = {} } = options ?? {}
const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey(petId)
const query = useQuery<TQueryFnData, TError, TData, any>({
...getPetByIdQueryOptions<TQueryFnData, TError, TData, TQueryData>(petId, clientOptions),
const query = useQuery<GetPetById['data'], GetPetById['error'], TData, any>({
...getPetByIdQueryOptions<TData, TQueryData>(petId, clientOptions),

Check warning on line 55 in examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts#L54-L55

Added lines #L54 - L55 were not covered by tests
queryKey,
...queryOptions,
}) as UseQueryResult<TData, TError> & {
}) as UseQueryResult<TData, GetPetById['error']> & {

Check warning on line 58 in examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts#L58

Added line #L58 was not covered by tests
queryKey: TQueryKey
}
query.queryKey = queryKey as TQueryKey
return query
}
export const getPetByIdInfiniteQueryKey = (petId: GetPetByIdPathParams['petId']) => [{ url: '/pet/:petId', params: { petId: petId } }] as const
export type GetPetByIdInfiniteQueryKey = ReturnType<typeof getPetByIdInfiniteQueryKey>
export function getPetByIdInfiniteQueryOptions<
TQueryFnData extends GetPetById['data'] = GetPetById['data'],
TError = GetPetById['error'],
TData = GetPetById['response'],
TQueryData = GetPetById['response'],
>(
export function getPetByIdInfiniteQueryOptions<TData = GetPetById['response'], TQueryData = GetPetById['response']>(

Check warning on line 66 in examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts#L66

Added line #L66 was not covered by tests
petId: GetPetByIdPathParams['petId'],
options: GetPetById['client']['parameters'] = {},
): WithRequired<UseInfiniteQueryOptions<GetPetById['response'], TError, TData, TQueryData>, 'queryKey'> {
): WithRequired<UseInfiniteQueryOptions<GetPetById['response'], GetPetById['error'], TData, TQueryData>, 'queryKey'> {

Check warning on line 69 in examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts#L68-L69

Added lines #L68 - L69 were not covered by tests
const queryKey = getPetByIdInfiniteQueryKey(petId)
return {
queryKey,
queryFn: async ({ pageParam }) => {
const res = await client<TQueryFnData, TError>({
const res = await client<GetPetById['data'], GetPetById['error']>({

Check warning on line 74 in examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts#L74

Added line #L74 was not covered by tests
method: 'get',
url: `/pet/${petId}`,
...options,
Expand All @@ -98,24 +85,22 @@
* @summary Find pet by ID
* @link /pet/:petId */
export function useGetPetByIdInfinite<
TQueryFnData extends GetPetById['data'] = GetPetById['data'],
TError = GetPetById['error'],
TData = GetPetById['response'],
TQueryData = GetPetById['response'],
TQueryKey extends QueryKey = GetPetByIdInfiniteQueryKey,
>(petId: GetPetByIdPathParams['petId'], options: {
query?: UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>
query?: UseInfiniteQueryOptions<GetPetById['data'], GetPetById['error'], TData, TQueryData, TQueryKey>
client?: GetPetById['client']['parameters']
} = {}): UseInfiniteQueryResult<TData, TError> & {
} = {}): UseInfiniteQueryResult<TData, GetPetById['error']> & {

Check warning on line 94 in examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts#L92-L94

Added lines #L92 - L94 were not covered by tests
queryKey: TQueryKey
} {
const { query: queryOptions, client: clientOptions = {} } = options ?? {}
const queryKey = queryOptions?.queryKey ?? getPetByIdInfiniteQueryKey(petId)
const query = useInfiniteQuery<TQueryFnData, TError, TData, any>({
...getPetByIdInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryData>(petId, clientOptions),
const query = useInfiniteQuery<GetPetById['data'], GetPetById['error'], TData, any>({
...getPetByIdInfiniteQueryOptions<TData, TQueryData>(petId, clientOptions),

Check warning on line 100 in examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts#L99-L100

Added lines #L99 - L100 were not covered by tests
queryKey,
...queryOptions,
}) as UseInfiniteQueryResult<TData, TError> & {
}) as UseInfiniteQueryResult<TData, GetPetById['error']> & {

Check warning on line 103 in examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts

View check run for this annotation

Codecov / codecov/patch

examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts#L103

Added line #L103 was not covered by tests
queryKey: TQueryKey
}
query.queryKey = queryKey as TQueryKey
Expand Down
Loading
Loading