diff --git a/e2e/tsconfig.json b/e2e/tsconfig.json index 449a5b7514..ea2e273dd8 100644 --- a/e2e/tsconfig.json +++ b/e2e/tsconfig.json @@ -6,7 +6,7 @@ "sourceMap": true, "strictNullChecks": true, "jsx": "react-jsx", - "outDir": "es", + "outDir": "dist", "experimentalDecorators": true, "skipLibCheck": true, "baseUrl": ".", @@ -15,6 +15,8 @@ "allowJs": true, "noEmit": true, "allowImportingTsExtensions": true, + "alwaysStrict": true, + "strict": true, "paths": { "@kubb/cli": ["../packages/cli/src/index.ts"], "@kubb/config-biome": ["../packages/config/config-biome/src/index.ts"], diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useAddPet.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useAddPet.ts index f6a7381de6..f9e41a8374 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useAddPet.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useAddPet.ts @@ -2,8 +2,6 @@ import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' import type { RequestConfig } from '../../../../swr-client.ts' import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../../../models/ts/petController/AddPet.ts' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' import { addPetMutationResponseSchema } from '../../../zod/petController/addPetSchema.ts' /** @@ -29,14 +27,14 @@ async function addPet(data: AddPetMutationRequest, config: Partial + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/pet'] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return addPet(data, config) diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useDeletePet.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useDeletePet.ts index 3760ef6c47..71e4789319 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useDeletePet.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useDeletePet.ts @@ -2,8 +2,6 @@ import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' import type { RequestConfig } from '../../../../swr-client.ts' import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../../../models/ts/petController/DeletePet.ts' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' import { deletePetMutationResponseSchema } from '../../../zod/petController/deletePetSchema.ts' /** @@ -31,14 +29,14 @@ export function useDeletePet( petId: DeletePetPathParams['petId'], headers?: DeletePetHeaderParams, options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/pet/${petId}`] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url) => { return deletePet(petId, headers, config) diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByStatus.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByStatus.ts index 1cb52af60b..1d1aec2a5c 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByStatus.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByStatus.ts @@ -2,7 +2,6 @@ import client from '../../../../swr-client.ts' import useSWR from 'swr' import type { RequestConfig } from '../../../../swr-client.ts' import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../../../models/ts/petController/FindPetsByStatus.ts' -import type { Key, SWRConfiguration } from 'swr' import { findPetsByStatusQueryResponseSchema } from '../../../zod/petController/findPetsByStatusSchema.ts' /** @@ -37,14 +36,14 @@ export function findPetsByStatusQueryOptions(params?: FindPetsByStatusQueryParam export function useFindPetsByStatus( params?: FindPetsByStatusQueryParams, options: { - query?: SWRConfiguration + query?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/pet/findByStatus', params] as const - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...findPetsByStatusQueryOptions(params, config), ...queryOptions, }) diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByTags.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByTags.ts index abd19081da..783e66f631 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByTags.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByTags.ts @@ -7,7 +7,6 @@ import type { FindPetsByTagsHeaderParams, FindPetsByTags400, } from '../../../models/ts/petController/FindPetsByTags.ts' -import type { Key, SWRConfiguration } from 'swr' import { findPetsByTagsQueryResponseSchema } from '../../../zod/petController/findPetsByTagsSchema.ts' /** @@ -44,14 +43,14 @@ export function useFindPetsByTags( headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: { - query?: SWRConfiguration + query?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/pet/findByTags', params] as const - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...findPetsByTagsQueryOptions(headers, params, config), ...queryOptions, }) diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useGetPetById.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useGetPetById.ts index e6a8252212..6c2556d2ba 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useGetPetById.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useGetPetById.ts @@ -2,7 +2,6 @@ import client from '../../../../swr-client.ts' import useSWR from 'swr' import type { RequestConfig } from '../../../../swr-client.ts' import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../../../models/ts/petController/GetPetById.ts' -import type { Key, SWRConfiguration } from 'swr' import { getPetByIdQueryResponseSchema } from '../../../zod/petController/getPetByIdSchema.ts' /** @@ -36,14 +35,14 @@ export function getPetByIdQueryOptions(petId: GetPetByIdPathParams['petId'], con export function useGetPetById( petId: GetPetByIdPathParams['petId'], options: { - query?: SWRConfiguration + query?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/pet/${petId}`] as const - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...getPetByIdQueryOptions(petId, config), ...queryOptions, }) diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePet.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePet.ts index 1f292ca623..26b70f4325 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePet.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePet.ts @@ -8,8 +8,6 @@ import type { UpdatePet404, UpdatePet405, } from '../../../models/ts/petController/UpdatePet.ts' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' import { updatePetMutationResponseSchema } from '../../../zod/petController/updatePetSchema.ts' /** @@ -35,14 +33,14 @@ async function updatePet(data: UpdatePetMutationRequest, config: Partial + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/pet'] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return updatePet(data, config) diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePetWithForm.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePetWithForm.ts index 2270b8f1dc..21556bbef0 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePetWithForm.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePetWithForm.ts @@ -7,8 +7,6 @@ import type { UpdatePetWithFormQueryParams, UpdatePetWithForm405, } from '../../../models/ts/petController/UpdatePetWithForm.ts' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' import { updatePetWithFormMutationResponseSchema } from '../../../zod/petController/updatePetWithFormSchema.ts' /** @@ -34,14 +32,14 @@ export function useUpdatePetWithForm( petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams, options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/pet/${petId}`, params] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url) => { return updatePetWithForm(petId, params, config) diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useUploadFile.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useUploadFile.ts index b17104bee0..970775cbb6 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useUploadFile.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useUploadFile.ts @@ -7,8 +7,6 @@ import type { UploadFilePathParams, UploadFileQueryParams, } from '../../../models/ts/petController/UploadFile.ts' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' import { uploadFileMutationResponseSchema } from '../../../zod/petController/uploadFileSchema.ts' /** @@ -41,14 +39,14 @@ export function useUploadFile( petId: UploadFilePathParams['petId'], params?: UploadFileQueryParams, options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/pet/${petId}/uploadImage`, params] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return uploadFile(petId, data, params, config) diff --git a/examples/advanced/src/gen/clients/swr/petsSWRController/useCreatePets.ts b/examples/advanced/src/gen/clients/swr/petsSWRController/useCreatePets.ts index b05d4817fa..96c9af8e15 100644 --- a/examples/advanced/src/gen/clients/swr/petsSWRController/useCreatePets.ts +++ b/examples/advanced/src/gen/clients/swr/petsSWRController/useCreatePets.ts @@ -8,8 +8,6 @@ import type { CreatePetsQueryParams, CreatePetsHeaderParams, } from '../../../models/ts/petsController/CreatePets.ts' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' import { createPetsMutationResponseSchema } from '../../../zod/petsController/createPetsSchema.ts' /** @@ -44,14 +42,14 @@ export function useCreatePets( headers: CreatePetsHeaderParams, params?: CreatePetsQueryParams, options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/pets/${uuid}`, params] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return createPets(uuid, data, headers, params, config) diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUser.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUser.ts index fe738b92ee..826a6cb7aa 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUser.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUser.ts @@ -2,8 +2,6 @@ import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' import type { RequestConfig } from '../../../../swr-client.ts' import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../../models/ts/userController/CreateUser.ts' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' import { createUserMutationResponseSchema } from '../../../zod/userController/createUserSchema.ts' /** @@ -29,14 +27,14 @@ async function createUser(data?: CreateUserMutationRequest, config: Partial + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/user'] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return createUser(data, config) diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUsersWithListInput.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUsersWithListInput.ts index 8e95ab1230..5225355e42 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUsersWithListInput.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUsersWithListInput.ts @@ -5,8 +5,6 @@ import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse, } from '../../../models/ts/userController/CreateUsersWithListInput.ts' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' import { createUsersWithListInputMutationResponseSchema } from '../../../zod/userController/createUsersWithListInputSchema.ts' /** @@ -35,14 +33,14 @@ async function createUsersWithListInput( */ export function useCreateUsersWithListInput( options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/user/createWithList'] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return createUsersWithListInput(data, config) diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useDeleteUser.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useDeleteUser.ts index 80bf7e1222..2550d80536 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useDeleteUser.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useDeleteUser.ts @@ -2,8 +2,6 @@ import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' import type { RequestConfig } from '../../../../swr-client.ts' import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../../../models/ts/userController/DeleteUser.ts' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' import { deleteUserMutationResponseSchema } from '../../../zod/userController/deleteUserSchema.ts' /** @@ -29,14 +27,14 @@ async function deleteUser(username: DeleteUserPathParams['username'], config: Pa export function useDeleteUser( username: DeleteUserPathParams['username'], options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/user/${username}`] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url) => { return deleteUser(username, config) diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useGetUserByName.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useGetUserByName.ts index a8d5941695..565911887e 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useGetUserByName.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useGetUserByName.ts @@ -7,7 +7,6 @@ import type { GetUserByName400, GetUserByName404, } from '../../../models/ts/userController/GetUserByName.ts' -import type { Key, SWRConfiguration } from 'swr' import { getUserByNameQueryResponseSchema } from '../../../zod/userController/getUserByNameSchema.ts' /** @@ -39,14 +38,14 @@ export function getUserByNameQueryOptions(username: GetUserByNamePathParams['use export function useGetUserByName( username: GetUserByNamePathParams['username'], options: { - query?: SWRConfiguration + query?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/user/${username}`] as const - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...getUserByNameQueryOptions(username, config), ...queryOptions, }) diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useLoginUser.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useLoginUser.ts index c37127dc2e..b7a169c401 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useLoginUser.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useLoginUser.ts @@ -2,7 +2,6 @@ import client from '../../../../swr-client.ts' import useSWR from 'swr' import type { RequestConfig } from '../../../../swr-client.ts' import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../../../models/ts/userController/LoginUser.ts' -import type { Key, SWRConfiguration } from 'swr' import { loginUserQueryResponseSchema } from '../../../zod/userController/loginUserSchema.ts' /** @@ -35,14 +34,14 @@ export function loginUserQueryOptions(params?: LoginUserQueryParams, config: Par export function useLoginUser( params?: LoginUserQueryParams, options: { - query?: SWRConfiguration + query?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/user/login', params] as const - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...loginUserQueryOptions(params, config), ...queryOptions, }) diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useLogoutUser.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useLogoutUser.ts index f41eadddf4..2458923ea9 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useLogoutUser.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useLogoutUser.ts @@ -2,7 +2,6 @@ import client from '../../../../swr-client.ts' import useSWR from 'swr' import type { RequestConfig } from '../../../../swr-client.ts' import type { LogoutUserQueryResponse } from '../../../models/ts/userController/LogoutUser.ts' -import type { Key, SWRConfiguration } from 'swr' import { logoutUserQueryResponseSchema } from '../../../zod/userController/logoutUserSchema.ts' /** @@ -33,14 +32,14 @@ export function logoutUserQueryOptions(config: Partial = {}) { */ export function useLogoutUser( options: { - query?: SWRConfiguration + query?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/user/logout'] as const - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...logoutUserQueryOptions(config), ...queryOptions, }) diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useUpdateUser.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useUpdateUser.ts index e0e3aff6b2..95fd36847a 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useUpdateUser.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useUpdateUser.ts @@ -2,8 +2,6 @@ import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' import type { RequestConfig } from '../../../../swr-client.ts' import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../../models/ts/userController/UpdateUser.ts' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' import { updateUserMutationResponseSchema } from '../../../zod/userController/updateUserSchema.ts' /** @@ -34,14 +32,14 @@ async function updateUser( export function useUpdateUser( username: UpdateUserPathParams['username'], options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/user/${username}`] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return updateUser(username, data, config) diff --git a/examples/advanced/tsconfig.json b/examples/advanced/tsconfig.json index 8165b189fe..ffcf620daf 100644 --- a/examples/advanced/tsconfig.json +++ b/examples/advanced/tsconfig.json @@ -16,7 +16,9 @@ "allowJs": true, "allowImportingTsExtensions": true, "verbatimModuleSyntax": true, - "noEmit": true + "noEmit": true, + "alwaysStrict": true, + "strict": true }, "include": ["./src/**/*", "./templates/**/*"], "exclude": ["**/node_modules", "**/types/**", "**/mocks/**"] diff --git a/examples/client/src/gen/clients/axios/petService/uploadFile.ts b/examples/client/src/gen/clients/axios/petService/uploadFile.ts index 6dff33192d..134d3cbe92 100644 --- a/examples/client/src/gen/clients/axios/petService/uploadFile.ts +++ b/examples/client/src/gen/clients/axios/petService/uploadFile.ts @@ -25,7 +25,7 @@ export async function uploadFile( const formData = new FormData() if (data) { Object.keys(data).forEach((key) => { - const value = data[key] + const value = data[key as keyof typeof data] if (typeof key === 'string' && (typeof value === 'string' || value instanceof Blob)) { formData.append(key, value) } diff --git a/examples/client/tsconfig.json b/examples/client/tsconfig.json index 675ca9bc25..ec88505e62 100644 --- a/examples/client/tsconfig.json +++ b/examples/client/tsconfig.json @@ -15,7 +15,9 @@ "esModuleInterop": true, "allowJs": true, "allowImportingTsExtensions": true, - "noEmit": true + "noEmit": true, + "alwaysStrict": true, + "strict": true }, "include": ["./src/**/*", "./templates/**/*"], "exclude": ["**/node_modules", "**/types/**", "**/mocks/**"] diff --git a/examples/fetch/src/gen/uploadFile.ts b/examples/fetch/src/gen/uploadFile.ts index 07901b4d2a..4f8ce89733 100644 --- a/examples/fetch/src/gen/uploadFile.ts +++ b/examples/fetch/src/gen/uploadFile.ts @@ -15,7 +15,7 @@ export async function uploadFile( const formData = new FormData() if (data) { Object.keys(data).forEach((key) => { - const value = data[key] + const value = data[key as keyof typeof data] if (typeof key === 'string' && (typeof value === 'string' || value instanceof Blob)) { formData.append(key, value) } diff --git a/examples/msw/tsconfig.json b/examples/msw/tsconfig.json index bb8115c2c3..f5403a879b 100644 --- a/examples/msw/tsconfig.json +++ b/examples/msw/tsconfig.json @@ -15,7 +15,9 @@ "esModuleInterop": true, "allowJs": true, "allowImportingTsExtensions": true, - "noEmit": true + "noEmit": true, + "alwaysStrict": true, + "strict": true }, "include": ["./src/**/*"], "exclude": ["**/node_modules", "**/types/**", "**/mocks/**"] diff --git a/examples/simple-single/tsconfig.json b/examples/simple-single/tsconfig.json index bb8115c2c3..f5403a879b 100644 --- a/examples/simple-single/tsconfig.json +++ b/examples/simple-single/tsconfig.json @@ -15,7 +15,9 @@ "esModuleInterop": true, "allowJs": true, "allowImportingTsExtensions": true, - "noEmit": true + "noEmit": true, + "alwaysStrict": true, + "strict": true }, "include": ["./src/**/*"], "exclude": ["**/node_modules", "**/types/**", "**/mocks/**"] diff --git a/examples/solid-query/tsconfig.json b/examples/solid-query/tsconfig.json index bb8115c2c3..f5403a879b 100644 --- a/examples/solid-query/tsconfig.json +++ b/examples/solid-query/tsconfig.json @@ -15,7 +15,9 @@ "esModuleInterop": true, "allowJs": true, "allowImportingTsExtensions": true, - "noEmit": true + "noEmit": true, + "alwaysStrict": true, + "strict": true }, "include": ["./src/**/*"], "exclude": ["**/node_modules", "**/types/**", "**/mocks/**"] diff --git a/examples/svelte-query/tsconfig.json b/examples/svelte-query/tsconfig.json index bb8115c2c3..f5403a879b 100644 --- a/examples/svelte-query/tsconfig.json +++ b/examples/svelte-query/tsconfig.json @@ -15,7 +15,9 @@ "esModuleInterop": true, "allowJs": true, "allowImportingTsExtensions": true, - "noEmit": true + "noEmit": true, + "alwaysStrict": true, + "strict": true }, "include": ["./src/**/*"], "exclude": ["**/node_modules", "**/types/**", "**/mocks/**"] diff --git a/examples/swr/src/gen/hooks/useAddPet.ts b/examples/swr/src/gen/hooks/useAddPet.ts index cedb7d39d6..6eae526e9c 100644 --- a/examples/swr/src/gen/hooks/useAddPet.ts +++ b/examples/swr/src/gen/hooks/useAddPet.ts @@ -2,8 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWRMutation from 'swr/mutation' import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../models/AddPet.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' /** * @description Add a new pet to the store @@ -28,14 +26,14 @@ async function addPet(data: AddPetMutationRequest, config: Partial + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/pet'] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return addPet(data, config) diff --git a/examples/swr/src/gen/hooks/useCreateUser.ts b/examples/swr/src/gen/hooks/useCreateUser.ts index 83e8663865..34468d6235 100644 --- a/examples/swr/src/gen/hooks/useCreateUser.ts +++ b/examples/swr/src/gen/hooks/useCreateUser.ts @@ -2,8 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWRMutation from 'swr/mutation' import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' /** * @description This can only be done by the logged in user. @@ -28,14 +26,14 @@ async function createUser(data?: CreateUserMutationRequest, config: Partial + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/user'] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return createUser(data, config) diff --git a/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts b/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts index 64a89bbde8..263395e538 100644 --- a/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts +++ b/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts @@ -2,8 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWRMutation from 'swr/mutation' import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' /** * @description Creates list of users with given input array @@ -31,14 +29,14 @@ async function createUsersWithListInput( */ export function useCreateUsersWithListInput( options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/user/createWithList'] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return createUsersWithListInput(data, config) diff --git a/examples/swr/src/gen/hooks/useDeleteOrder.ts b/examples/swr/src/gen/hooks/useDeleteOrder.ts index 859d061ebf..a1c1eb5917 100644 --- a/examples/swr/src/gen/hooks/useDeleteOrder.ts +++ b/examples/swr/src/gen/hooks/useDeleteOrder.ts @@ -2,8 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWRMutation from 'swr/mutation' import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from '../models/DeleteOrder.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' /** * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -28,14 +26,14 @@ async function deleteOrder(orderId: DeleteOrderPathParams['orderId'], config: Pa export function useDeleteOrder( orderId: DeleteOrderPathParams['orderId'], options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/store/order/${orderId}`] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url) => { return deleteOrder(orderId, config) diff --git a/examples/swr/src/gen/hooks/useDeletePet.ts b/examples/swr/src/gen/hooks/useDeletePet.ts index 0ce503e4a7..337524d8da 100644 --- a/examples/swr/src/gen/hooks/useDeletePet.ts +++ b/examples/swr/src/gen/hooks/useDeletePet.ts @@ -2,8 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWRMutation from 'swr/mutation' import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../models/DeletePet.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' /** * @description delete a pet @@ -30,14 +28,14 @@ export function useDeletePet( petId: DeletePetPathParams['petId'], headers?: DeletePetHeaderParams, options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/pet/${petId}`] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url) => { return deletePet(petId, headers, config) diff --git a/examples/swr/src/gen/hooks/useDeleteUser.ts b/examples/swr/src/gen/hooks/useDeleteUser.ts index 70dd66ad8d..d2522bbf81 100644 --- a/examples/swr/src/gen/hooks/useDeleteUser.ts +++ b/examples/swr/src/gen/hooks/useDeleteUser.ts @@ -2,8 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWRMutation from 'swr/mutation' import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../models/DeleteUser.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' /** * @description This can only be done by the logged in user. @@ -28,14 +26,14 @@ async function deleteUser(username: DeleteUserPathParams['username'], config: Pa export function useDeleteUser( username: DeleteUserPathParams['username'], options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/user/${username}`] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url) => { return deleteUser(username, config) diff --git a/examples/swr/src/gen/hooks/useFindPetsByStatus.ts b/examples/swr/src/gen/hooks/useFindPetsByStatus.ts index e610965ef3..96c48220a7 100644 --- a/examples/swr/src/gen/hooks/useFindPetsByStatus.ts +++ b/examples/swr/src/gen/hooks/useFindPetsByStatus.ts @@ -2,7 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWR from 'swr' import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../models/FindPetsByStatus.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key, SWRConfiguration } from 'swr' /** * @description Multiple status values can be provided with comma separated strings @@ -36,14 +35,14 @@ export function findPetsByStatusQueryOptions(params?: FindPetsByStatusQueryParam export function useFindPetsByStatus( params?: FindPetsByStatusQueryParams, options: { - query?: SWRConfiguration + query?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/pet/findByStatus', params] as const - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...findPetsByStatusQueryOptions(params, config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/useFindPetsByTags.ts b/examples/swr/src/gen/hooks/useFindPetsByTags.ts index e37018b87e..5e73788952 100644 --- a/examples/swr/src/gen/hooks/useFindPetsByTags.ts +++ b/examples/swr/src/gen/hooks/useFindPetsByTags.ts @@ -2,7 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWR from 'swr' import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../models/FindPetsByTags.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key, SWRConfiguration } from 'swr' /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -36,14 +35,14 @@ export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, c export function useFindPetsByTags( params?: FindPetsByTagsQueryParams, options: { - query?: SWRConfiguration + query?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/pet/findByTags', params] as const - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...findPetsByTagsQueryOptions(params, config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/useGetInventory.ts b/examples/swr/src/gen/hooks/useGetInventory.ts index 22c39ee1d2..1f29aa6720 100644 --- a/examples/swr/src/gen/hooks/useGetInventory.ts +++ b/examples/swr/src/gen/hooks/useGetInventory.ts @@ -2,7 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWR from 'swr' import type { GetInventoryQueryResponse } from '../models/GetInventory.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key, SWRConfiguration } from 'swr' /** * @description Returns a map of status codes to quantities @@ -34,14 +33,14 @@ export function getInventoryQueryOptions(config: Partial = {}) { */ export function useGetInventory( options: { - query?: SWRConfiguration + query?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/store/inventory'] as const - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...getInventoryQueryOptions(config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/useGetOrderById.ts b/examples/swr/src/gen/hooks/useGetOrderById.ts index 796db74875..89d84b2680 100644 --- a/examples/swr/src/gen/hooks/useGetOrderById.ts +++ b/examples/swr/src/gen/hooks/useGetOrderById.ts @@ -2,7 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWR from 'swr' import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../models/GetOrderById.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key, SWRConfiguration } from 'swr' /** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. @@ -35,14 +34,14 @@ export function getOrderByIdQueryOptions(orderId: GetOrderByIdPathParams['orderI export function useGetOrderById( orderId: GetOrderByIdPathParams['orderId'], options: { - query?: SWRConfiguration + query?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/store/order/${orderId}`] as const - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...getOrderByIdQueryOptions(orderId, config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/useGetPetById.ts b/examples/swr/src/gen/hooks/useGetPetById.ts index 62fe233aba..869204f3de 100644 --- a/examples/swr/src/gen/hooks/useGetPetById.ts +++ b/examples/swr/src/gen/hooks/useGetPetById.ts @@ -2,7 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWR from 'swr' import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../models/GetPetById.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key, SWRConfiguration } from 'swr' /** * @description Returns a single pet @@ -35,14 +34,14 @@ export function getPetByIdQueryOptions(petId: GetPetByIdPathParams['petId'], con export function useGetPetById( petId: GetPetByIdPathParams['petId'], options: { - query?: SWRConfiguration + query?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/pet/${petId}`] as const - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...getPetByIdQueryOptions(petId, config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/useGetUserByName.ts b/examples/swr/src/gen/hooks/useGetUserByName.ts index 939268fb83..193f11caec 100644 --- a/examples/swr/src/gen/hooks/useGetUserByName.ts +++ b/examples/swr/src/gen/hooks/useGetUserByName.ts @@ -2,7 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWR from 'swr' import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../models/GetUserByName.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key, SWRConfiguration } from 'swr' /** * @summary Get user by user name @@ -33,14 +32,14 @@ export function getUserByNameQueryOptions(username: GetUserByNamePathParams['use export function useGetUserByName( username: GetUserByNamePathParams['username'], options: { - query?: SWRConfiguration + query?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/user/${username}`] as const - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...getUserByNameQueryOptions(username, config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/useLoginUser.ts b/examples/swr/src/gen/hooks/useLoginUser.ts index c2dfae05ad..7bd1e27728 100644 --- a/examples/swr/src/gen/hooks/useLoginUser.ts +++ b/examples/swr/src/gen/hooks/useLoginUser.ts @@ -2,7 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWR from 'swr' import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../models/LoginUser.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key, SWRConfiguration } from 'swr' /** * @summary Logs user into the system @@ -34,14 +33,14 @@ export function loginUserQueryOptions(params?: LoginUserQueryParams, config: Par export function useLoginUser( params?: LoginUserQueryParams, options: { - query?: SWRConfiguration + query?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/user/login', params] as const - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...loginUserQueryOptions(params, config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/useLogoutUser.ts b/examples/swr/src/gen/hooks/useLogoutUser.ts index 5f7bc25fd8..a90df8ba58 100644 --- a/examples/swr/src/gen/hooks/useLogoutUser.ts +++ b/examples/swr/src/gen/hooks/useLogoutUser.ts @@ -2,7 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWR from 'swr' import type { LogoutUserQueryResponse } from '../models/LogoutUser.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key, SWRConfiguration } from 'swr' /** * @summary Logs out current logged in user session @@ -32,14 +31,14 @@ export function logoutUserQueryOptions(config: Partial = {}) { */ export function useLogoutUser( options: { - query?: SWRConfiguration + query?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/user/logout'] as const - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...logoutUserQueryOptions(config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/usePlaceOrder.ts b/examples/swr/src/gen/hooks/usePlaceOrder.ts index f6e0af2c9c..8e0fcb31ad 100644 --- a/examples/swr/src/gen/hooks/usePlaceOrder.ts +++ b/examples/swr/src/gen/hooks/usePlaceOrder.ts @@ -2,8 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWRMutation from 'swr/mutation' import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from '../models/PlaceOrder.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' /** * @description Place a new order in the store @@ -28,14 +26,14 @@ async function placeOrder(data?: PlaceOrderMutationRequest, config: Partial + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/store/order'] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return placeOrder(data, config) diff --git a/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts b/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts index 6c8ee827e2..d5967fe97d 100644 --- a/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts +++ b/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts @@ -2,8 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWRMutation from 'swr/mutation' import type { PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse, PlaceOrderPatch405 } from '../models/PlaceOrderPatch.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' /** * @description Place a new order in the store with patch @@ -28,14 +26,14 @@ async function placeOrderPatch(data?: PlaceOrderPatchMutationRequest, config: Pa */ export function usePlaceOrderPatch( options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/store/order'] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return placeOrderPatch(data, config) diff --git a/examples/swr/src/gen/hooks/useUpdatePet.ts b/examples/swr/src/gen/hooks/useUpdatePet.ts index 16f8cc5397..efc79f0503 100644 --- a/examples/swr/src/gen/hooks/useUpdatePet.ts +++ b/examples/swr/src/gen/hooks/useUpdatePet.ts @@ -2,8 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWRMutation from 'swr/mutation' import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from '../models/UpdatePet.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' /** * @description Update an existing pet by Id @@ -28,14 +26,14 @@ async function updatePet(data: UpdatePetMutationRequest, config: Partial + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = ['/pet'] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return updatePet(data, config) diff --git a/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts b/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts index 8f7117b504..a3b67ffd62 100644 --- a/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts +++ b/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts @@ -7,8 +7,6 @@ import type { UpdatePetWithForm405, } from '../models/UpdatePetWithForm.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' /** * @summary Updates a pet in the store with form data @@ -33,14 +31,14 @@ export function useUpdatePetWithForm( petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams, options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/pet/${petId}`, params] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url) => { return updatePetWithForm(petId, params, config) diff --git a/examples/swr/src/gen/hooks/useUpdateUser.ts b/examples/swr/src/gen/hooks/useUpdateUser.ts index fdb224cd92..f5e303c9bd 100644 --- a/examples/swr/src/gen/hooks/useUpdateUser.ts +++ b/examples/swr/src/gen/hooks/useUpdateUser.ts @@ -2,8 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWRMutation from 'swr/mutation' import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' /** * @description This can only be done by the logged in user. @@ -33,14 +31,14 @@ async function updateUser( export function useUpdateUser( username: UpdateUserPathParams['username'], options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/user/${username}`] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return updateUser(username, data, config) diff --git a/examples/swr/src/gen/hooks/useUploadFile.ts b/examples/swr/src/gen/hooks/useUploadFile.ts index d8c7e53345..70dda421b6 100644 --- a/examples/swr/src/gen/hooks/useUploadFile.ts +++ b/examples/swr/src/gen/hooks/useUploadFile.ts @@ -2,8 +2,6 @@ import client from '@kubb/plugin-client/client' import useSWRMutation from 'swr/mutation' import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from '../models/UploadFile.ts' import type { RequestConfig } from '@kubb/plugin-client/client' -import type { Key } from 'swr' -import type { SWRMutationConfiguration } from 'swr/mutation' /** * @summary uploads an image @@ -35,14 +33,14 @@ export function useUploadFile( petId: UploadFilePathParams['petId'], params?: UploadFileQueryParams, options: { - mutation?: SWRMutationConfiguration + mutation?: Parameters>[2] client?: Partial> shouldFetch?: boolean } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const swrKey = [`/pet/${petId}/uploadImage`, params] as const - return useSWRMutation( + return useSWRMutation( shouldFetch ? swrKey : null, async (_url, { arg: data }) => { return uploadFile(petId, data, params, config) diff --git a/examples/swr/tsconfig.json b/examples/swr/tsconfig.json index bb8115c2c3..f5403a879b 100644 --- a/examples/swr/tsconfig.json +++ b/examples/swr/tsconfig.json @@ -15,7 +15,9 @@ "esModuleInterop": true, "allowJs": true, "allowImportingTsExtensions": true, - "noEmit": true + "noEmit": true, + "alwaysStrict": true, + "strict": true }, "include": ["./src/**/*"], "exclude": ["**/node_modules", "**/types/**", "**/mocks/**"] diff --git a/examples/typescript/tsconfig.json b/examples/typescript/tsconfig.json index bb8115c2c3..f5403a879b 100644 --- a/examples/typescript/tsconfig.json +++ b/examples/typescript/tsconfig.json @@ -15,7 +15,9 @@ "esModuleInterop": true, "allowJs": true, "allowImportingTsExtensions": true, - "noEmit": true + "noEmit": true, + "alwaysStrict": true, + "strict": true }, "include": ["./src/**/*"], "exclude": ["**/node_modules", "**/types/**", "**/mocks/**"] diff --git a/examples/vue-query/tsconfig.json b/examples/vue-query/tsconfig.json index f380327613..9f204e83fb 100644 --- a/examples/vue-query/tsconfig.json +++ b/examples/vue-query/tsconfig.json @@ -16,7 +16,9 @@ "allowJs": true, "allowImportingTsExtensions": true, "noEmit": true, - "paths": {} + "paths": {}, + "alwaysStrict": true, + "strict": true }, "include": ["./src/**/*", "vite.config.ts", "shims-vue.d.ts"], "exclude": ["**/node_modules", "**/types/**", "**/mocks/**"] diff --git a/packages/plugin-client/src/components/Client.tsx b/packages/plugin-client/src/components/Client.tsx index ab36166048..bc13685fb9 100644 --- a/packages/plugin-client/src/components/Client.tsx +++ b/packages/plugin-client/src/components/Client.tsx @@ -124,7 +124,7 @@ export function Client({ const formData = new FormData() if(data) { Object.keys(data).forEach((key) => { - const value = data[key]; + const value = data[key as keyof typeof data]; if (typeof key === "string" && (typeof value === "string" || value instanceof Blob)) { formData.append(key, value); } diff --git a/packages/plugin-swr/src/components/Mutation.tsx b/packages/plugin-swr/src/components/Mutation.tsx index 36ea04d01c..b77833d761 100644 --- a/packages/plugin-swr/src/components/Mutation.tsx +++ b/packages/plugin-swr/src/components/Mutation.tsx @@ -50,7 +50,7 @@ function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsPro options: { type: ` { - mutation?: SWRMutationConfiguration<${[TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'unknown'].join(', ')}>, + mutation?: Parameters item.name).join(' | ') || 'Error'].join(', ')}, any>>[2], client?: ${typeSchemas.request?.name ? `Partial>` : 'Partial'}, shouldFetch?: boolean, } @@ -63,7 +63,7 @@ function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsPro export function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation }: Props): ReactNode { const path = new URLPath(operation.path) const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` - const hookGenerics = [TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'unknown', 'Key'] + const hookGenerics = [TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', 'typeof swrKey | null'] const params = getParams({ pathParamsType, diff --git a/packages/plugin-swr/src/components/Query.tsx b/packages/plugin-swr/src/components/Query.tsx index 99664c70cc..f86a6bc23b 100644 --- a/packages/plugin-swr/src/components/Query.tsx +++ b/packages/plugin-swr/src/components/Query.tsx @@ -56,7 +56,7 @@ function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsPro options: { type: ` { - query?: SWRConfiguration<${[TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'unknown'].join(', ')}>, + query?: Parameters item.name).join(' | ') || 'Error'].join(', ')}, any>>[2], client?: ${typeSchemas.request?.name ? `Partial>` : 'Partial'}, shouldFetch?: boolean, } @@ -69,7 +69,7 @@ function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsPro export function Query({ name, typeSchemas, queryOptionsName, operation, dataReturnType, pathParamsType }: Props): ReactNode { const path = new URLPath(operation.path) const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` - const hookGenerics = [TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'unknown', 'Key'] + const hookGenerics = [TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', 'typeof swrKey | null'] const params = getParams({ pathParamsType, dataReturnType, diff --git a/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts b/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts index 4a693e50ec..47943fbc79 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts @@ -1,7 +1,6 @@ import client from "@kubb/plugin-client/client"; import useSWR from "swr"; import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client"; -import type { Key, SWRConfiguration } from "swr"; /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -27,13 +26,13 @@ async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partia * @link /pet/findByTags */ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { - query?: SWRConfiguration, FindPetsByTags400>; + query?: Parameters, FindPetsByTags400, any>>[2]; client?: Partial; shouldFetch?: boolean; } = {}) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; const swrKey = [`/pet/findByTags`, params] as const; - return useSWR, FindPetsByTags400, Key>(shouldFetch ? swrKey : null, { + return useSWR, FindPetsByTags400, typeof swrKey | null>(shouldFetch ? swrKey : null, { ...findPetsByTagsQueryOptions(params, config), ...queryOptions }); diff --git a/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts b/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts index e362fe97a1..bd74a70744 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts @@ -1,7 +1,6 @@ import client from "axios"; import useSWR from "swr"; import type { RequestConfig } from "axios"; -import type { Key, SWRConfiguration } from "swr"; /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -27,13 +26,13 @@ async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partia * @link /pet/findByTags */ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { - query?: SWRConfiguration; + query?: Parameters>[2]; client?: Partial; shouldFetch?: boolean; } = {}) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; const swrKey = [`/pet/findByTags`, params] as const; - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...findPetsByTagsQueryOptions(params, config), ...queryOptions }); diff --git a/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts b/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts index d2002e7147..9043057d27 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts @@ -1,8 +1,6 @@ import client from "axios"; import useSWRMutation from "swr/mutation"; import type { RequestConfig } from "axios"; -import type { Key } from "swr"; -import type { SWRMutationConfiguration } from "swr/mutation"; /** * @summary Updates a pet in the store with form data @@ -18,13 +16,13 @@ async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], pa * @link /pet/:petId */ export function useUpdatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, options: { - mutation?: SWRMutationConfiguration; + mutation?: Parameters>[2]; client?: Partial; shouldFetch?: boolean; } = {}) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}; const swrKey = [`/pet/${petId}`, params] as const; - return useSWRMutation(shouldFetch ? swrKey : null, async (_url) => { + return useSWRMutation(shouldFetch ? swrKey : null, async (_url) => { return updatePetWithForm(petId, params, config); }, mutationOptions); } diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts index 36993e6049..130a7c87fc 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts @@ -1,7 +1,6 @@ import client from "@kubb/plugin-client/client"; import useSWR from "swr"; import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { Key, SWRConfiguration } from "swr"; /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -27,13 +26,13 @@ async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partia * @link /pet/findByTags */ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { - query?: SWRConfiguration; + query?: Parameters>[2]; client?: Partial; shouldFetch?: boolean; } = {}) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; const swrKey = [`/pet/findByTags`, params] as const; - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...findPetsByTagsQueryOptions(params, config), ...queryOptions }); diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts index 36993e6049..130a7c87fc 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,7 +1,6 @@ import client from "@kubb/plugin-client/client"; import useSWR from "swr"; import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { Key, SWRConfiguration } from "swr"; /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -27,13 +26,13 @@ async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partia * @link /pet/findByTags */ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { - query?: SWRConfiguration; + query?: Parameters>[2]; client?: Partial; shouldFetch?: boolean; } = {}) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; const swrKey = [`/pet/findByTags`, params] as const; - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...findPetsByTagsQueryOptions(params, config), ...queryOptions }); diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts index 468de44f67..589972318b 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,7 +1,6 @@ import client from "@kubb/plugin-client/client"; import useSWR from "swr"; import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { Key, SWRConfiguration } from "swr"; /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -27,13 +26,13 @@ async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partia * @link /pet/findByTags */ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { - query?: SWRConfiguration; + query?: Parameters>[2]; client?: Partial; shouldFetch?: boolean; } = {}) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; const swrKey = [`/pet/findByTags`, params] as const; - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...findPetsByTagsQueryOptions(params, config), ...queryOptions }); diff --git a/packages/plugin-swr/src/generators/__snapshots__/getAsMutation.ts b/packages/plugin-swr/src/generators/__snapshots__/getAsMutation.ts index 1f92065a91..30244c0b16 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/getAsMutation.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/getAsMutation.ts @@ -1,8 +1,6 @@ import client from "@kubb/plugin-client/client"; import useSWRMutation from "custom-swr/mutation"; import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { SWRMutationConfiguration } from "custom-swr/mutation"; -import type { Key } from "swr"; /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -20,13 +18,13 @@ async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partia * @link /pet/findByTags */ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { - mutation?: SWRMutationConfiguration; + mutation?: Parameters>[2]; client?: Partial; shouldFetch?: boolean; } = {}) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}; const swrKey = [`/pet/findByTags`, params] as const; - return useSWRMutation(shouldFetch ? swrKey : null, async (_url) => { + return useSWRMutation(shouldFetch ? swrKey : null, async (_url) => { return findPetsByTags(params, config); }, mutationOptions); } diff --git a/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts index 54da206471..0ae1469b34 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts @@ -1,8 +1,6 @@ import client from "@kubb/plugin-client/client"; import useSWR from "custom-swr"; import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { SWRConfiguration } from "custom-swr"; -import type { Key } from "swr"; /** * @summary Updates a pet in the store with form data @@ -26,13 +24,13 @@ async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], pa * @link /pet/:petId */ export function useUpdatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, options: { - query?: SWRConfiguration; + query?: Parameters>[2]; client?: Partial; shouldFetch?: boolean; } = {}) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; const swrKey = [`/pet/${petId}`, params] as const; - return useSWR(shouldFetch ? swrKey : null, { + return useSWR(shouldFetch ? swrKey : null, { ...updatePetWithFormQueryOptions(petId, params, config), ...queryOptions }); diff --git a/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts index da7587b7c9..acb892acf0 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts @@ -1,8 +1,6 @@ import client from "@kubb/plugin-client/client"; import useSWRMutation from "swr/mutation"; import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { Key } from "swr"; -import type { SWRMutationConfiguration } from "swr/mutation"; /** * @summary Updates a pet in the store with form data @@ -18,13 +16,13 @@ async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], pa * @link /pet/:petId */ export function useUpdatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, options: { - mutation?: SWRMutationConfiguration; + mutation?: Parameters>[2]; client?: Partial; shouldFetch?: boolean; } = {}) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}; const swrKey = [`/pet/${petId}`, params] as const; - return useSWRMutation(shouldFetch ? swrKey : null, async (_url) => { + return useSWRMutation(shouldFetch ? swrKey : null, async (_url) => { return updatePetWithForm(petId, params, config); }, mutationOptions); } diff --git a/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index 1cf90c3c6d..4dac24471a 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -1,8 +1,6 @@ import client from "@kubb/plugin-client/client"; import useSWRMutation from "swr/mutation"; import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { Key } from "swr"; -import type { SWRMutationConfiguration } from "swr/mutation"; /** * @summary Updates a pet in the store with form data @@ -22,13 +20,13 @@ async function updatePetWithForm({ petId }: { export function useUpdatePetWithForm({ petId }: { petId: UpdatePetWithFormPathParams["petId"]; }, params?: UpdatePetWithFormQueryParams, options: { - mutation?: SWRMutationConfiguration; + mutation?: Parameters>[2]; client?: Partial; shouldFetch?: boolean; } = {}) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}; const swrKey = [`/pet/${petId}`, params] as const; - return useSWRMutation(shouldFetch ? swrKey : null, async (_url) => { + return useSWRMutation(shouldFetch ? swrKey : null, async (_url) => { return updatePetWithForm({ petId }, params, config); }, mutationOptions); } diff --git a/packages/plugin-swr/src/generators/mutationGenerator.tsx b/packages/plugin-swr/src/generators/mutationGenerator.tsx index bae1e73ee8..f5540c9833 100644 --- a/packages/plugin-swr/src/generators/mutationGenerator.tsx +++ b/packages/plugin-swr/src/generators/mutationGenerator.tsx @@ -50,9 +50,8 @@ export const mutationGenerator = createReactGenerator({ {options.parser === 'zod' && ( )} - - + ({ return ( {options.parser === 'zod' && } - - + {options.client.dataReturnType === 'full' && }