code: function newRangeCount(
    prev: {first: number, last: number},
    next: {first: number, last: number},
  ): number {
    return (
      next.last -
      next.first +
      1 -
      Math.max(
        0,
        1 + Math.min(next.last, prev.last) - Math.max(next.first, prev.first),
      )
    );
  }
docs: Computes the number of elements in the `next` range that are new compared to the `prev` range.
  Handy for calculating how many new items will be rendered when the render window changes so we
  can restrict the number of new items render at once so that content can appear on the screen
  faster.