ReactQuery: Typecheck fails on the generated code
Opened this issue · 1 comments
What are the steps to reproduce this issue?
-
yarn run build
-
Errors:
../../resources/common/src/clients/models/check503Info.ts:14:5 - error TS2411: Property 'status' of type 'string | undefined' is not assignable to 'string' index type 'string'.
14 status?: string;
~~~~~~
817 const formData = new FormData();
~~~~~~~~
../../resources/common/src/clients/api/events/events.ts:890:24 - error TS2693: 'FormData' only refers to a type, but is being used as a value here
What happens?
When I build a project with the generated orval clients it fails.
export const createEvent = (createEventBody: CreateEventBody) => {
const formData = new FormData();
if (createEventBody.coverImage !== undefined) {
formData.append("coverImage", createEventBody.coverImage);
}
if (createEventBody.data !== undefined) {
formData.append("data", JSON.stringify(createEventBody.data));
}
return customInstance<PrivateEventDto>({
url: `/events`,
method: "POST",
headers: { "Content-Type": "multipart/form-data" },
data: formData,
});
};
What were you expecting to happen?
Not to fail.
Any logs, error output, etc?
Any other comments?
module.exports = {
'api-clients': {
input: './bin/definition.yaml',
output: {
client: 'react-query',
httpClient: 'axios',
target: '../../resources/common/src/clients/api/index.ts',
schemas: '../../resources/common/src/clients/models',
indexFiles: true,
mode: 'tags-split',
mock: false,
prettier: true,
hooks: {
afterAllFilesWrite: 'prettier --write',
},
override: {
mutator: {
path: '../../resources/common/src/clients/mutator/custom-instance.ts',
name: 'customInstance',
},
query: {
useQuery: true,
signal: true,
indexFiles: true,
useInfiniteQueryParam: "page",
},
},
},
},
}
What versions are you using?
Please execute npx envinfo --system --npmPackages orval,zod,axios,msw,swr,@tanstack/react-query,@tanstack/vue-query,react,vue
and paste the results here.
System:
OS: macOS 14.5
CPU: (10) arm64 Apple M1 Max
Memory: 107.83 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
npmPackages:
orval: ^7.0.1 => 7.0.1
"typescript": "^5.3.3"
can you provide your openAPI document too so it can be reproduced?