We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7c8f9d9 commit 7a50e50Copy full SHA for 7a50e50
1 file changed
sample/24-auth-jwt/src/users/users.service.ts
@@ -1,8 +1,10 @@
1
import { Injectable } from '@nestjs/common';
2
3
+export type User = any;
4
+
5
@Injectable()
6
export class UsersService {
- private readonly users;
7
+ private readonly users: User[];
8
9
constructor() {
10
this.users = [
@@ -24,7 +26,7 @@ export class UsersService {
24
26
];
25
27
}
28
- async findOne(username): Promise<any> {
- return this.users.filter(user => user.username === username)[0];
29
+ async findOne(username: string): Promise<User | undefined> {
30
+ return this.users.find(user => user.username === username);
31
32
0 commit comments