people: Fix get_custom_fields_by_type type.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2024-05-29 22:44:37 -07:00
committed by Anders Kaseorg
parent a01d68e838
commit c20af83770

View File

@@ -1722,13 +1722,13 @@ export function get_custom_profile_data(
export function get_custom_fields_by_type( export function get_custom_fields_by_type(
user_id: number, user_id: number,
field_type: number, field_type: number,
): ProfileDatum[] | null { ): (ProfileDatum | undefined)[] | null {
const person = get_by_user_id(user_id); const person = get_by_user_id(user_id);
const profile_data = person.profile_data; const profile_data = person.profile_data;
if (profile_data === undefined) { if (profile_data === undefined) {
return null; return null;
} }
const filteredProfileData: ProfileDatum[] = []; const filteredProfileData: (ProfileDatum | undefined)[] = [];
for (const field of realm.custom_profile_fields) { for (const field of realm.custom_profile_fields) {
if (field.type === field_type) { if (field.type === field_type) {
filteredProfileData.push(profile_data[field.id]); filteredProfileData.push(profile_data[field.id]);