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

  let left = 0;
  let right = nums.length - 1;

  // Find the first occurrence of the target
  while (left <= right) {
    const mid = Math.floor((left + right) / 2);
    if (nums[mid] < target) {
      left = mid + 1;
    } else {
      right = mid - 1;
    }
  }

  // If target is not found, return [-1, -1]
  if (left >= nums.length || nums[left] !== target) return [-1, -1];

  const firstIndex = left;

  // Find the last occurrence of the target
  right = nums.length - 1;
  while (left <= right) {
    const mid = Math.floor((left + right) / 2);
    if (nums[mid] <= target) {
      left = mid + 1;
    } else {
      right = mid - 1;
    }
  }

  return [firstIndex, right];
}
```