Skip to content

Commit b7ab496

Browse files
chore: fix enum types
1 parent 3a7f2aa commit b7ab496

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ export interface BooleanValidatorType extends Validator<boolean> {
306306
}
307307

308308
export interface EnumValidatorType<T extends string | number> extends Validator<T> {
309-
allowedValues: readonly T[]
309+
getAllowedValues: () => readonly T[]
310310
custom: (fn: (value: T) => boolean, message: string) => EnumValidator<T>
311311
}
312312

src/validators/enums.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export class EnumValidator<T extends string | number> extends BaseValidator<T> i
1717
})
1818
}
1919

20+
getAllowedValues(): readonly T[] {
21+
return this.allowedValues
22+
}
23+
2024
custom(fn: (value: T) => boolean, message: string): this {
2125
return this.addRule({
2226
name: 'custom',

0 commit comments

Comments
 (0)