mrjono1 / joi-to-typescript

Convert Joi Schemas to TypeScript interfaces
MIT License
125 stars 39 forks source link

converting to .default() doesn't make sense #355

Closed qraxiss closed 11 months ago

qraxiss commented 1 year ago

Describe the bug x.default() -> x?

i think it doesn't make sense, because default always defined

mrjono1 commented 1 year ago

At the moment everything is default to optional, yes making this to required by default would be better.

as a workaround you can do 2 things use the defaultToRequired setting or .requried()

qraxiss commented 1 year ago

when i use .default().required(), field cannot empty

mrjono1 commented 1 year ago

I think you need to set what the default value is

qraxiss commented 11 months ago

https://github.com/hapijs/joi/issues/2973#event-10095896576