Skip to content

Wrong error message when validations in union member fail #577

@i-am-ian

Description

@i-am-ian

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions