fix(common): 修复@genex/common包TypeScript编译错误
- current-user.decorator: 移除显式返回类型以兼容undefined字段访问 - http-exception.filter: 为message变量提供默认值避免TS2454 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d48bd3acb9
commit
a31c1aa478
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export class AllExceptionsFilter implements ExceptionFilter {
|
|||
const request = ctx.getRequest<Request>();
|
||||
|
||||
let status: number;
|
||||
let message: string;
|
||||
let message: string = 'Unknown error';
|
||||
let details: any;
|
||||
|
||||
if (exception instanceof HttpException) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue