eivindfjeldstad/validate

Fix `.enum()` Param Typing of `string[]`

Opened this issue · 0 comments

image

Currently, the enum method is typed to take a parameter of string[]. However, I have found that this method supports a number[] as well. Any chance we can get the typing corrected or otherwise allow a way to provide a number[]?

export enum Status {
    Start = 10,
    InProgress = 20,
    Finish = 30,
}

const start = Status.Start;
console.log(
    new Schema().path('currentStatus').enum([
        Status.Start,
        Status.InProgress,
    ]).validate(start)
);  //null