```ts
export function searchRange(nums: number[], target: number): [number, number] {
    // Helper function to find the first occurrence of target
    const findFirst = (): number => {
        let left = 0;
        let right = nums.length - 1;
        let result = -1;
        
        while (left <= right) {
            const mid = Math.floor((left + right) / 2);
            
            if (nums[mid] === target) {
                result = mid;
                right = mid - 1; // Continue searching in the left half
            } else if (nums[mid] < target) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }
        
        return result;
    };
    
    // Helper function to find the last occurrence of target
    const findLast = (): number => {
        let left = 0;
        let right = nums.length - 1;
        let result = -1;
        
        while (left <= right) {
            const mid = Math.floor((left + right) / 2);
            
            if (nums[mid] === target) {
                result = mid;
                left = mid + 1; // Continue searching in the right half
            } else if (nums[mid] < target) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }
        
        return result;
    };
    
    const firstIndex = findFirst();
    
    // If target not found, return [-1, -1]
    if (firstIndex === -1) {
        return [-1, -1];
    }
    
    const lastIndex = findLast();
    
    return [firstIndex, lastIndex];
}
```