| unknown included in all the types... am I missing something or does that defeat much of the purpose of generating types? #1786
-
In my experiments with openapi-ts I'm not finding the generated SDK to be very user friendly. I'm wondering if I'm missing something. I've created a stackblitz as an example project: https://stackblitz.com/edit/vitejs-vite-7fsyogyy?file=src%2FApp.tsx. The generated code is in The most important part of
handleGetHelloResponse2 is sort of how I expected to work with the generated SDK, handleGetHelloResponse1 is how it seems I actually have to work with it. The issue is that with the data element having the Am I missing something about how to use this library effectively? Or how to work with the generated types more conveniently? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@scottstephens why not this? async function handleClick(
event: React.MouseEvent<HTMLButtonElement, MouseEvent>
) {
const { data } = await getHello()
if (data) {
handleGetHelloResponse2({ data })
}
} or if you don't want to do checks... async function handleClick(
event: React.MouseEvent<HTMLButtonElement, MouseEvent>
) {
const { data } = await getHello({ throwOnError: true })
handleGetHelloResponse2({ data })
} |
Beta Was this translation helpful? Give feedback.
@scottstephens why not this?
or if you don't want to do checks...