Open Drarig29 opened 2 years ago
I found it redundant to have to specify every parameter of TypedRequest everytime, so I created this file, which replaces TypedRequest<TParams, TQuery, TBody> with:
TypedRequest
TypedRequest<TParams, TQuery, TBody>
TypedRequest<S extends { params?: z.AnyZodObject, query?: z.AnyZodObject, body?: z.AnyZodObject, }>
So now, I can do:
const mySchemaParams = z.object({}); const mySchemaQuery = z.object({}); const mySchemaBody = z.object({}); export const mySchema = { params: mySchemaParams, query: mySchemaQuery, body: mySchemaBody, }; export type MyCustomRequest = TypedRequest<typeof mySchema>
I found it redundant to have to specify every parameter of
TypedRequest
everytime, so I created this file, which replacesTypedRequest<TParams, TQuery, TBody>
with:So now, I can do: