```
export function carveShift(start: number, end: number, span: number, rest: number, least: number): number[][] {
  if (!Number.isInteger(start) || !Number.isInteger(end) || !Number.isInteger(span) || !Number.isInteger(rest) || !Number.isInteger(least)) {
    throw new Error("All arguments must be whole numbers.");
  }
  if (start >= end) {
    throw new Error("Start must precede end.");
  }
  if (span < 1 || rest < 1 || least <= 0 || least > span) {
    throw new Error("Span, rest, and least must be positive integers with least greater than 0 and less than or equal to span.");
  }

  const shifts = [];
  let currentFrom = start;
  while (currentFrom < end) {
    const nextFrom = Math.min(currentFrom + span, end);
    if (nextFrom - currentFrom >= least) {
      shifts.push([currentFrom, nextFrom]);
    }
    currentFrom += rest;
  }

  return shifts;
}
```