From c6b434adddc7e4afea44d863e0dc18c580e837d6 Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Tue, 13 Dec 2022 20:36:30 +0900 Subject: [PATCH] refactor: shorten --- deno_dist/context.ts | 2 +- deno_dist/middleware/validator/middleware.ts | 4 ++-- src/context.ts | 2 +- src/middleware/validator/middleware.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/deno_dist/context.ts b/deno_dist/context.ts index 5bb7e410..4f830e5a 100644 --- a/deno_dist/context.ts +++ b/deno_dist/context.ts @@ -37,7 +37,7 @@ export class Context< notFoundHandler: NotFoundHandler = () => new Response() ) { this._executionCtx = executionCtx - this.req = req as Request : S> + this.req = req as Request this.env = env this.notFoundHandler = notFoundHandler diff --git a/deno_dist/middleware/validator/middleware.ts b/deno_dist/middleware/validator/middleware.ts index 090d69cc..0ac37513 100644 --- a/deno_dist/middleware/validator/middleware.ts +++ b/deno_dist/middleware/validator/middleware.ts @@ -40,14 +40,14 @@ export const validatorMiddleware = < } const schema = validationFunction(v, c) - const validatorList = getValidatorList(schema) + const validatorList = getValidatorList(schema) // eslint-disable-next-line @typescript-eslint/no-explicit-any let data: any = {} for (const [keys, validator] of validatorList) { let results: ValidateResult[] try { - results = await validator.validate(c.req as Request) + results = await validator.validate(c.req) } catch (e) { // Invalid JSON request if (e instanceof Error) { diff --git a/src/context.ts b/src/context.ts index da612ba7..e8c738ae 100644 --- a/src/context.ts +++ b/src/context.ts @@ -37,7 +37,7 @@ export class Context< notFoundHandler: NotFoundHandler = () => new Response() ) { this._executionCtx = executionCtx - this.req = req as Request : S> + this.req = req as Request this.env = env this.notFoundHandler = notFoundHandler diff --git a/src/middleware/validator/middleware.ts b/src/middleware/validator/middleware.ts index 61b54309..fc9b0ff0 100644 --- a/src/middleware/validator/middleware.ts +++ b/src/middleware/validator/middleware.ts @@ -40,14 +40,14 @@ export const validatorMiddleware = < } const schema = validationFunction(v, c) - const validatorList = getValidatorList(schema) + const validatorList = getValidatorList(schema) // eslint-disable-next-line @typescript-eslint/no-explicit-any let data: any = {} for (const [keys, validator] of validatorList) { let results: ValidateResult[] try { - results = await validator.validate(c.req as Request) + results = await validator.validate(c.req) } catch (e) { // Invalid JSON request if (e instanceof Error) {