Open birksy89 opened 5 months ago
Yeah that is a nice idea, we can have the types exported.
For now though you can just copy the type after converting the zod schema into a type using type MyType = z.infer<typeof MySchema>
Thanks for the quick reply!
I hope what I said made sense, the example code above is me just manually writing a TypeScript type in the Axios generic.
I could have written it as a Zod Schema, and inferred the type from that - As you've said above. (Big fan of Zod, and doing exactly that)
But it would still mean at the moment that I'd need to write out the expected response shape as a Zod Schema?
I'm not sure exactly where the Types would be exported from at this stage - Is this something that already exists somewhere?
I found this, but wasn't sure if it was the right thing: https://www.npmjs.com/package/@dytesdk/web-core
So I just used the Axios setup as is shown in this example repo here: https://github.com/dyte-io/express-backend-sample/blob/main/src/utils/dyte-api.ts
Thanks again
Hello, thanks for this example - It's very useful.
Is there anyway of getting the potential responses strongly typed?
Is there a Node SDK or just a list of types which could be imported?
I'm just trialling Dyte, and at the moment I'm manually writing out the response shape.
Any help would be greatly appreciated