function toJsxIdOrMemberExpression(ids) {
  let index = -1
  /** @type {JSXIdentifier | JSXMemberExpression | undefined} */
  let object

  while (++index < ids.length) {
    const name = ids[index]
    assert(
      typeof name === 'string' && isIdentifierName(name, {jsx: true}),
      'expected valid jsx identifier, not `' + name + '`'
    )

    /** @type {JSXIdentifier} */
    const id = {type: 'JSXIdentifier', name}
    object = object ? {type: 'JSXMemberExpression', object, property: id} : id
  }

  assert(object, 'expected non-empty `ids` to be passed')
  return object
}
@param {ReadonlyArray<number | string>} ids
  Identifiers (example: `['list', 0]).
@returns {JSXIdentifier | JSXMemberExpression}
  Identifier or member expression.