You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TS2509: Base constructor return type '{ [k in keyof addQuestionMarks<baseObjectOutputType<{ field: ZodOptional<this>; another: ZodString; }>, any>]: addQuestionMarks<baseObjectOutputType<{ field: ZodOptional<...>; another: ZodString; }>, any>[k]; }' is not an object type or intersection of object types with statically known members.
27 | });
28 |
> 29 | export class TestDto extends createZodDto(testSchema) {}
So I just figured out I could use field: z.optional(z.string()) and it works like expected 👍
Maybe someone could still check if the other way is working somehow?
Hey, I'm trying to create a DTO with optional properties. Simple setup:
However it fails with:
I feel like this would be very basic and common use case. So I wonder what could be wrong on my side?
I followed the instructions of https://github.com/wahyubucil/nestjs-zod-openapi/ to set things up.
Thanks :)
The text was updated successfully, but these errors were encountered: