Fix gt, gte, lt, lte arg type.

This commit is contained in:
maruware
2019-02-25 19:38:06 +09:00
parent b1285dace3
commit e1e28b2afc
2 changed files with 7 additions and 4 deletions

View File

@@ -30,10 +30,10 @@ declare namespace KoaBouncer {
isNotIn(arr: any[], tip?: string): Validator
isArray(tip?: string): Validator
eq(otherVal: string, tip?: string): Validator
gt(otherVal: string, tip?: string): Validator
gte(otherVal: string, tip?: string): Validator
lt(otherVal: string, tip?: string): Validator
lte(otherVal: string, tip?: string): Validator
gt(otherVal: number, tip?: string): Validator
gte(otherVal: number, tip?: string): Validator
lt(otherVal: number, tip?: string): Validator
lte(otherVal: number, tip?: string): Validator
isLength(min: number, max: number, tip?: string): Validator
defaultTo(valueOrFunction: any): Validator
isString(tip?: string): Validator

View File

@@ -29,6 +29,9 @@ router.post('/users', async (ctx) => {
.isString()
.eq(ctx.vals.password1, 'Passwords must match')
ctx.validateBody('age')
.gte(18, 'Must be 18 or older')
console.log(ctx.vals)
})