From a31c1aa4785e845c61fe5bc4c03f7637b689331c Mon Sep 17 00:00:00 2001 From: hailin Date: Thu, 19 Feb 2026 19:04:21 -0800 Subject: [PATCH] =?UTF-8?q?fix(common):=20=E4=BF=AE=E5=A4=8D@genex/common?= =?UTF-8?q?=E5=8C=85TypeScript=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - current-user.decorator: 移除显式返回类型以兼容undefined字段访问 - http-exception.filter: 为message变量提供默认值避免TS2454 Co-Authored-By: Claude Opus 4.6 --- .../packages/common/src/decorators/current-user.decorator.ts | 2 +- backend/packages/common/src/filters/http-exception.filter.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/packages/common/src/decorators/current-user.decorator.ts b/backend/packages/common/src/decorators/current-user.decorator.ts index 9aacfa4..e82af61 100644 --- a/backend/packages/common/src/decorators/current-user.decorator.ts +++ b/backend/packages/common/src/decorators/current-user.decorator.ts @@ -6,7 +6,7 @@ import { JwtPayload } from '../interfaces/jwt-payload.interface'; * Usage: @CurrentUser() user: JwtPayload */ export const CurrentUser = createParamDecorator( - (data: keyof JwtPayload | undefined, ctx: ExecutionContext): JwtPayload => { + (data: keyof JwtPayload | undefined, ctx: ExecutionContext) => { const request = ctx.switchToHttp().getRequest(); const user = request.user as JwtPayload; return data ? user?.[data] : user; diff --git a/backend/packages/common/src/filters/http-exception.filter.ts b/backend/packages/common/src/filters/http-exception.filter.ts index b0becb7..f1311ae 100644 --- a/backend/packages/common/src/filters/http-exception.filter.ts +++ b/backend/packages/common/src/filters/http-exception.filter.ts @@ -22,7 +22,7 @@ export class AllExceptionsFilter implements ExceptionFilter { const request = ctx.getRequest(); let status: number; - let message: string; + let message: string = 'Unknown error'; let details: any; if (exception instanceof HttpException) {