This commit is contained in:
syuilo
2023-02-22 15:28:17 +09:00
parent 3bb7afe544
commit 0fb9c372dd
22 changed files with 69 additions and 71 deletions

View File

@@ -1,7 +1,3 @@
export default function(user: { name?: string | null, username: string }): string {
// Show username if name is empty.
// XXX: typescript-eslint has no configuration to allow using `||` against string.
// https://github.com/typescript-eslint/typescript-eslint/issues/4906
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
return user.name || user.username;
return user.name === '' ? user.username : user.name ?? user.username;
}