I suggest to use strictNullCheck flag in compiler options. TS will start to look different on optional object. When you add | undefined to value definition strictNullCheck flag will force you to check is value is not undefined, or map type by as { id: number; name: string } syntax when you sure about returned type
interface IDict {
[key: string]: { id: number; name: string } | undefined;
}
const something = (unknownKey: string) => {
const aDict: IDict = {};
const a = aDict[unknownKey];
console.log(a.name); // error
if (a !== undefined) {
console.log(a.name); // ok
}
console.log((a as { id: number; name: string }).name); //also ok
};
Playground