declare function get(x: U, y: Y): U[Y]; declare function find(o: T[K]): [T, K]; function impl(a: A, b: B) { const item = get(a, b); return find(item); } const o = {x: 42}; const r = impl(o, "x"); r[0][r[1]] = o[r[1]];