// @flow

function foo() {
  const x: {a?: {b: ReadonlyArray<{c: number, ...}>, ...}, ...} = {};
  const y = x.a?.b;
  type T = (typeof y)[0]; // error: undefined does not have properties
  const z: T = 1;
}
