A library which allows to author mongoose ("a MongoDB object modeling tool") schemas using zod ("a TypeScript-first schema declaration and validation library").
MIT License
49
stars
7
forks
source link
Addressing I get the error: `.mongooseTypeOptions/.mongoose is not a function` #2
The error is caused because the z.ZObject prototype is extended
Because is some cases there can be multiple imports of z it is impossible to tell if the right prototype is extended. It is a bad practice because you have no control over the z object as an user of this library.
It would be useful if the z object of mongoose-zod is exposed or we can pass a zObject by reference instead of extending the prototype
The error is caused because the z.ZObject prototype is extended
Because is some cases there can be multiple imports of z it is impossible to tell if the right prototype is extended. It is a bad practice because you have no control over the z object as an user of this library.
It would be useful if the z object of mongoose-zod is exposed or we can pass a zObject by reference instead of extending the prototype