openapi-codegen
openapi-codegen copied to clipboard
Binding element 'signal' implicitly has an 'any' type
In the generated code for components, I'm running into a problem due to our TypeScript configuration disallowing implicit any.
The error I get when running tsc as part of our build process:
src/generated/user/userComponents.ts:993:8 - error TS7031: Binding element 'signal' implicitly has an 'any' type.
993 ({ signal }) => fetchGetCurrentUser({ ...fetcherOptions, ...variables }, signal),
It looks like this single line could be fixed by setting a type on the signal property like:
({ signal }: { signal?: AbortSignal }) =>
fetchGetCurrentUser({ ...fetcherOptions, ...variables }, signal),
Either that or defining a type like type SignalOption = { signal?: AbortSignal } and using that there.
Maybe there's a better way to do it to have the compiler infer the type for signal.
It would be nice to have the type explicitly defined to avoid this problem.
Dependencies snippet:
"@openapi-codegen/cli": "^2.0.0",
"@openapi-codegen/typescript": "^6.0.0",
"typescript": "^4.7.4",
hi, @calvinf can you share your tsconfig? and what version are you using for @tanstack/react-query?