Skip to content

Commit f3cd77a

Browse files
committed
refactor: add typing for getRequestToken request variable
1 parent 730f242 commit f3cd77a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

server/src/lib/GetRequestUser.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ import {
44
HttpStatus,
55
createParamDecorator,
66
} from '@nestjs/common';
7+
import type { Request } from 'express';
78

89
import type { UserDocument } from '@server/user/entity/user.entity';
910

1011
export const GetRequestToken = createParamDecorator(
1112
(data: unknown, ctx: ExecutionContext) => {
12-
const req = ctx.switchToHttp().getRequest();
13-
const user = req.existingUser as UserDocument;
13+
const req = ctx
14+
.switchToHttp()
15+
.getRequest<Request & { existingUser: UserDocument }>();
16+
17+
const user = req.existingUser;
1418

1519
return user;
1620
},

0 commit comments

Comments
 (0)