Interfaces are helpful when you pass objects around. An optional property may be missing. A readonly property can’t be changed after it’s set. You will model a small profile and create a short label string from it.
interface Movie {
readonly id: number;
title: string;
year?: number;
}Keep the logic simple and do not change the input object.
Create a profile interface and format a label.
interface Profile with readonly id: number, name: string, age?: number.formatProfile(p: Profile): string.age exists, return "<name> (<age>) [id:<id>]"."<name> (unknown) [id:<id>]".