From c4fd92e28948439bce5e9d51269d108cd71d417d Mon Sep 17 00:00:00 2001 From: "Chen, Tai-Lin" Date: Mon, 11 Mar 2024 21:04:32 +0800 Subject: [PATCH] fix types issue --- server/src/middleware/error.ts | 5 ++++- server/src/utils/auth.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/src/middleware/error.ts b/server/src/middleware/error.ts index 30739d1..f05667e 100644 --- a/server/src/middleware/error.ts +++ b/server/src/middleware/error.ts @@ -1,7 +1,10 @@ import type { Request, Response, NextFunction } from 'express' import logger from '../utils/logger.js' -export function asyncHandler(fn: any) { +export function asyncHandler( + // eslint-disable-next-line no-unused-vars + fn: (req: Request, res: Response, next: NextFunction) => Promise +) { return (req: Request, res: Response, next: NextFunction) => { fn(req, res, next).catch(next) } diff --git a/server/src/utils/auth.ts b/server/src/utils/auth.ts index 751ae8f..f381e74 100644 --- a/server/src/utils/auth.ts +++ b/server/src/utils/auth.ts @@ -6,7 +6,7 @@ export function hashPassword(password: string): Promise { return bcrypt.hash(password, 10) } -export function genJWT(payload: any): Promise { +export function genJWT(payload: { [key: string]: string }): Promise { return new Promise((resolve, reject) => { jwt.sign( payload,