hapijs / joi

The most powerful data validation library for JS
Other
20.89k stars 1.51k forks source link

Property 'min' does not exist on type 'StringSchema<string>'. #3006

Closed johnsls closed 7 months ago

johnsls commented 10 months ago

Runtime

nodeJs

Runtime version

v18.17.1

Module version

17.9.1

Last module version without issue

No response

Used with

ReactJs, TypeScript, Vite.js

Any other relevant information

image

What are you trying to achieve or the steps to reproduce?

I'm trying to do a simple min and max form validation, but the min property doesn't exist. I installed the Joi lib in version 17.9.1 but the min wasn't working, so I installed the lib types and it still didn't work.

What was the result you got?

I was unable to use validation so that the field was at least 3 characters long

What result did you expect?

I expected the validated field to be at least 3 characters long

evertonpontes commented 10 months ago

Can you upload a minimal reproduction project that exhibits this issue?

Marsup commented 7 months ago

This looks similar to #3012, and I also cannot reproduce that in ts playground. I'm also going to close this one for the same reasons, I don't know what's happening with your projects, but something else is interfering with joi types, maybe your own declaration merging, or another module's. If you ever find the culprit, I'm interested.