```ts
export function searchRange(nums: number[], target: number): [number, number] {
  if (nums.length === 0) {
    return [-1, -1];
  }

  // Find the leftmost index where target could be inserted
  const left = binarySearchLeft(nums, target);
  if (left === nums.length || nums[left] !== target) {
    return [-1, -1];
  }

  // Find the rightmost index where target could be inserted
  const right = binarySearchRight(nums, target);
  
  return [left, right - 1];
}

function binarySearchLeft(nums: number[], target: number): number {
  let left = 0;
  let right = nums.length;
  
  while (left < right) {
    const mid = Math.floor((left + right) / 2);
    if (nums[mid] < target) {
      left = mid + 1;
    } else {
      right = mid;
    }
  }
  
  return left;
}

function binarySearchRight(nums: number[], target: number): number {
  let left = 0;
  let right = nums.length;
  
  while (left < right) {
    const mid = Math.floor((left + right) / 2);
    if (nums[mid] <= target) {
      left = mid + 1;
    } else {
      right = mid;
    }
  }
  
  return left;
}
```