From 87eb099d340e56ef9bf86ab697ef0e179934b643 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Thu, 29 Apr 2021 16:40:13 +0200 Subject: [PATCH] UsersService: Remove null from toUserDto return type toUserDto won't return null, as TS's strict mode prevents user from being nullish Signed-off-by: David Mehren --- src/users/users.service.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/users/users.service.ts b/src/users/users.service.ts index 7a10b8fac..f7ce84217 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -108,13 +108,9 @@ export class UsersService { /** * Build UserInfoDto from a user. * @param {User=} user - the user to use - * @return {(UserInfoDto|null)} the built UserInfoDto + * @return {(UserInfoDto)} the built UserInfoDto */ - toUserDto(user: User | null | undefined): UserInfoDto | null { - if (!user) { - this.logger.warn(`Recieved ${String(user)} argument!`, 'toUserDto'); - return null; - } + toUserDto(user: User): UserInfoDto { return { userName: user.userName, displayName: user.displayName,