getPathTo = (parent, child) => {
  const path = [];

  while (child._item !== null && child !== parent) {
    if (child._item.parentSub !== null) {
      // parent is map-ish
      path.unshift(child._item.parentSub);
    } else {
      // parent is array-ish
      let i = 0;
      let c =
      /** @type {AbstractType<any>} */
      child._item.parent._start;

      while (c !== child._item && c !== null) {
        if (!c.deleted) {
          i++;
        }

        c = c.right;
      }

      path.unshift(i);
    }

    child =
    /** @type {AbstractType<any>} */
    child._item.parent;
  }

  return path;
}
Compute the path from this type to the specified target.

@example
  // `child` should be accessible via `type.get(path[0]).get(path[1])..`
  const path = type.getPathTo(child)
  // assuming `type instanceof YArray`
  console.log(path) // might look like => [2, 'key1']
  child === type.get(path[0]).get(path[1])

@param {AbstractType<any>} parent
@param {AbstractType<any>} child target
@return {Array<string|number>} Path to the target

@private
@function