Skip to content

Commit 02c2d51

Browse files
fix: types
1 parent 5cf47e1 commit 02c2d51

File tree

15 files changed

+61
-74
lines changed

15 files changed

+61
-74
lines changed

src/types/array.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import type { ArrayValidator } from '../validators/arrays'
21
import type { LengthValidator, Validator } from './base'
32

4-
export interface ArrayValidatorType<T> extends Validator<T[]>, LengthValidator<ArrayValidator<T>> {
5-
each: (validator: Validator<T>) => ArrayValidator<T>
6-
unique: () => ArrayValidator<T>
3+
export interface ArrayValidatorType<T> extends Validator<T[]>, LengthValidator<ArrayValidatorType<T>> {
4+
each: (validator: Validator<T>) => ArrayValidatorType<T>
5+
unique: () => ArrayValidatorType<T>
76
}

src/types/binary.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import type { BinaryValidator } from '../validators/binary'
21
import type { LengthValidator, Validator } from './base'
32

4-
export interface BinaryValidatorType extends Validator<string>, LengthValidator<BinaryValidator> {
5-
custom: (fn: (value: string) => boolean, message: string) => BinaryValidator
3+
export interface BinaryValidatorType extends Validator<string>, LengthValidator<BinaryValidatorType> {
4+
custom: (fn: (value: string) => boolean, message: string) => BinaryValidatorType
65
}

src/types/blob.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import type { BlobValidator } from '../validators/blob'
21
import type { LengthValidator, Validator } from './base'
32

4-
export interface BlobValidatorType extends Validator<string>, LengthValidator<BlobValidator> {
5-
custom: (fn: (value: string) => boolean, message: string) => BlobValidator
3+
export interface BlobValidatorType extends Validator<string>, LengthValidator<BlobValidatorType> {
4+
custom: (fn: (value: string) => boolean, message: string) => BlobValidatorType
65
}

src/types/boolean.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import type { BooleanValidator } from '../validators/booleans'
21
import type { Validator } from './base'
32

43
export interface IsBooleanOptions {
54
loose?: boolean
65
}
76

87
export interface BooleanValidatorType extends Validator<boolean> {
9-
isTrue: () => BooleanValidator
10-
isFalse: () => BooleanValidator
11-
custom: (fn: (value: boolean) => boolean, message: string) => BooleanValidator
8+
isTrue: () => BooleanValidatorType
9+
isFalse: () => BooleanValidatorType
10+
custom: (fn: (value: boolean) => boolean, message: string) => BooleanValidatorType
1211
}

src/types/decimal.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import type { DecimalValidator } from '../validators/decimal'
21
import type { LengthValidator, Validator } from './base'
32

4-
export interface DecimalValidatorType extends Validator<number>, LengthValidator<DecimalValidator> {
5-
positive: () => DecimalValidator
6-
negative: () => DecimalValidator
7-
divisibleBy: (divisor: number) => DecimalValidator
8-
custom: (fn: (value: number | null | undefined) => boolean, message: string) => DecimalValidator
3+
export interface DecimalValidatorType extends Validator<number>, LengthValidator<DecimalValidatorType> {
4+
positive: () => DecimalValidatorType
5+
negative: () => DecimalValidatorType
6+
divisibleBy: (divisor: number) => DecimalValidatorType
7+
custom: (fn: (value: number | null | undefined) => boolean, message: string) => DecimalValidatorType
98
}

src/types/double.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import type { DoubleValidator } from '../validators/double'
21
import type { LengthValidator, Validator } from './base'
32

4-
export interface DoubleValidatorType extends Validator<number>, LengthValidator<DoubleValidator> {
5-
positive: () => DoubleValidator
6-
negative: () => DoubleValidator
7-
divisibleBy: (divisor: number) => DoubleValidator
8-
custom: (fn: (value: number | null | undefined) => boolean, message: string) => DoubleValidator
3+
export interface DoubleValidatorType extends Validator<number>, LengthValidator<DoubleValidatorType> {
4+
positive: () => DoubleValidatorType
5+
negative: () => DoubleValidatorType
6+
divisibleBy: (divisor: number) => DoubleValidatorType
7+
custom: (fn: (value: number | null | undefined) => boolean, message: string) => DoubleValidatorType
98
}

src/types/enum.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import type { EnumValidator } from '../validators/enums'
21
import type { Validator } from './base'
32

43
export interface EnumValidatorType<T extends string | number> extends Validator<T> {
54
getAllowedValues: () => readonly T[]
6-
custom: (fn: (value: T) => boolean, message: string) => EnumValidator<T>
5+
custom: (fn: (value: T) => boolean, message: string) => EnumValidatorType<T>
76
}

src/types/float.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { FloatValidator } from '../validators/float'
21
import type { LengthValidator, Validator } from './base'
32

43
export interface FloatOptions {
@@ -9,9 +8,9 @@ export interface FloatOptions {
98
gt?: number
109
}
1110

12-
export interface FloatValidatorType extends Validator<number>, LengthValidator<FloatValidator> {
13-
positive: () => FloatValidator
14-
negative: () => FloatValidator
15-
divisibleBy: (divisor: number) => FloatValidator
16-
custom: (fn: (value: number | null | undefined) => boolean, message: string) => FloatValidator
11+
export interface FloatValidatorType extends Validator<number>, LengthValidator<FloatValidatorType> {
12+
positive: () => FloatValidatorType
13+
negative: () => FloatValidatorType
14+
divisibleBy: (divisor: number) => FloatValidatorType
15+
custom: (fn: (value: number | null | undefined) => boolean, message: string) => FloatValidatorType
1716
}

src/types/number.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { NumberValidator } from '../validators/numbers'
21
import type { LengthValidator, Validator } from './base'
32

43
export interface IsIntOptions {
@@ -14,17 +13,16 @@ export interface NumericOptions {
1413
locale?: string
1514
}
1615

17-
export interface NumberValidatorType extends Validator<number>, LengthValidator<NumberValidator> {
18-
integer: (options?: IsIntOptions) => NumberValidator
19-
positive: () => NumberValidator
20-
negative: () => NumberValidator
21-
divisibleBy: (divisor: number) => NumberValidator
22-
custom: (fn: (value: number | null | undefined) => boolean, message: string) => NumberValidator
16+
export interface NumberValidatorType extends Validator<number>, LengthValidator<NumberValidatorType> {
17+
integer: (options?: IsIntOptions) => NumberValidatorType
18+
positive: () => NumberValidatorType
19+
negative: () => NumberValidatorType
20+
divisibleBy: (divisor: number) => NumberValidatorType
21+
custom: (fn: (value: number | null | undefined) => boolean, message: string) => NumberValidatorType
2322
}
2423

2524
export interface BigintValidatorType extends Validator<bigint> {
2625
min: (min: bigint) => BigintValidatorType
27-
max: (max: bigint) => BigintValidatorType
2826
positive: () => BigintValidatorType
2927
negative: () => BigintValidatorType
3028
divisibleBy: (divisor: bigint) => BigintValidatorType

src/types/object.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import type { ObjectValidator } from '../validators/objects'
21
import type { Validator } from './base'
32

43
export interface ObjectValidatorType<T extends Record<string, any>> extends Validator<T> {
5-
shape: (schema: Record<string, Validator<any>>) => ObjectValidator<T>
6-
strict: (strict?: boolean) => ObjectValidator<T>
4+
shape: (schema: Record<string, Validator<any>>) => ObjectValidatorType<T>
5+
strict: (strict?: boolean) => ObjectValidatorType<T>
76
}

0 commit comments

Comments
 (0)