```typescript
export function parseSpan(text: string): number {
    if (typeof text !== 'string' || !text.trim()) throw new Error('Invalid span text');

    const parts = text.split(/\s+/);
    const units = ['yd', 'ft', 'in'];
    let totalInches = 0;

    for (let i = 0; i < parts.length; i++) {
        if (!/^\d+$/.test(parts[i])) throw new Error('Invalid span text');
        const value = parseInt(parts[i], 10);

        if (units.indexOf(parts[i + 1]) === -1) {
            throw new Error('Unknown unit in span text');
        }

        switch (parts[i + 1]) {
            case 'yd':
                totalInches += value * 36;
                break;
            case 'ft':
                totalInches += value * 12;
                break;
            case 'in':
                totalInches += value;
                break;
        }

        i++;
    }

    return totalInches;
}

export function formatSpan(inches: number): string {
    if (typeof inches !== 'number' || isNaN(inches) || inches < 0) throw new Error('Invalid input');

    const units = ['yd', 'ft', 'in'];
    let result = '';

    for (let i = 2; i >= 0; i--) {
        const value = Math.floor(inches / (36 / Math.pow(10, i)));
        if (value > 0) {
            result += `${value}${units[i] + ' '}`;
            inches %= (36 / Math.pow(10, i));
        }
    }

    return result.trim();
}

export function addSpans(first: string, second: string): string {
    const totalInches = parseSpan(first) + parseSpan(second);
    return formatSpan(totalInches);
}
```