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 <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-04-29 16:40:13 +02:00
parent a453344205
commit 87eb099d34
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -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,