deepkit-framework icon indicating copy to clipboard operation
deepkit-framework copied to clipboard

Wrong error message when validations in union member fail

Open i-am-ian opened this issue 1 year ago • 0 comments

Hi,

First I just want to say that I really appreciate all the work that's being put into deepkit, I'm really enjoying it.

I recently came across an issue (I'm using deepkit/type 1.0.1-alpha.151):

class MyClass {
    code!: (string & MinLength<1> & MaxLength<2>) | null;
}

When validation of code fails due to specifying an empty string or a string with length > 2 I correctly get a validation error. However, the error message I get is No valid union member found. Valid: string | null.

Instead, I would expect to receive either Min length is 1 or Max length is 2.

i-am-ian avatar Jun 21 '24 21:06 i-am-ian