export function getAtPath(obj: unknown, path: string): unknown { if (obj == null) return undefined; // Split "a.b[0].c" -> ['a','b','0','c'] const segments = path.replace(/\[(\d+)\]/g, '.$1').split('.').filter(Boolean); let cur: unknown = obj; for (const seg of segments) { if (cur == null || typeof cur !== 'object') return undefined; cur = (cur as Record)[seg]; } return cur; }