Fixe type errors
This commit is contained in:
2
apps/dispatch/next-env.d.ts
vendored
2
apps/dispatch/next-env.d.ts
vendored
@@ -1,6 +1,6 @@
|
|||||||
/// <reference types="next" />
|
/// <reference types="next" />
|
||||||
/// <reference types="next/image-types/global" />
|
/// <reference types="next/image-types/global" />
|
||||||
import "./.next/dev/types/routes.d.ts";
|
import "./.next/types/routes.d.ts";
|
||||||
|
|
||||||
// NOTE: This file should not be edited
|
// NOTE: This file should not be edited
|
||||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ export const DISCORD_ROLES = {
|
|||||||
|
|
||||||
export const getPublicUser = (
|
export const getPublicUser = (
|
||||||
user: User,
|
user: User,
|
||||||
options = {
|
options?: {
|
||||||
ignorePrivacy: false,
|
ignorePrivacy?: boolean;
|
||||||
fullLastName: false,
|
fullLastName?: boolean;
|
||||||
},
|
},
|
||||||
): PublicUser => {
|
): PublicUser => {
|
||||||
const lastName = user.lastname
|
const lastName = user.lastname
|
||||||
@@ -50,7 +50,7 @@ export const getPublicUser = (
|
|||||||
.map((part) => `${part[0] || ""}.`)
|
.map((part) => `${part[0] || ""}.`)
|
||||||
.join(" ");
|
.join(" ");
|
||||||
|
|
||||||
if (options.fullLastName) {
|
if (options?.fullLastName) {
|
||||||
return {
|
return {
|
||||||
firstname: user.firstname,
|
firstname: user.firstname,
|
||||||
lastname: user.settingsHideLastname && !options.ignorePrivacy ? "" : user.lastname,
|
lastname: user.settingsHideLastname && !options.ignorePrivacy ? "" : user.lastname,
|
||||||
@@ -63,9 +63,9 @@ export const getPublicUser = (
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
firstname: user.firstname,
|
firstname: user.firstname,
|
||||||
lastname: user.settingsHideLastname && !options.ignorePrivacy ? "" : lastName.trim(), // Only take the first letter of each section of the last name
|
lastname: user.settingsHideLastname && !options?.ignorePrivacy ? "" : lastName.trim(), // Only take the first letter of each section of the last name
|
||||||
fullName:
|
fullName:
|
||||||
`${user.firstname} ${user.settingsHideLastname && !options.ignorePrivacy ? "" : lastName}`.trim(),
|
`${user.firstname} ${user.settingsHideLastname && !options?.ignorePrivacy ? "" : lastName}`.trim(),
|
||||||
publicId: user.publicId,
|
publicId: user.publicId,
|
||||||
badges: user.badges,
|
badges: user.badges,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user