I'm working with a user object (fetched from a GetMember endpoint) defined roughly as follows:
interface Member {
id: string;
name: string;
avatarUrl: string;
color: string;
info: Record<string, string>;
}
The info record contains user-defined fields for display on their profile. A specific user's field definitions can be fetched from a GetFields/{userId} endpoint:
interface MemberField {
id: string;
name: string;
type: number;
}
The Member.info record will contain every field returned from this response, so as the developer I know the properties exist, but I can't figure out how to tell Typescript that. Is this something that would be better handled by a validator?