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

  const parts = text.split(' ');
  if (parts.length === 0) {
    throw new Error('Empty span');
  }

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

  for (let i = 0; i < parts.length; i++) {
    const valueText = parts[i].replace(/[^0-9]/g, '');
    if (!valueText) {
      throw new Error('Invalid unit');
    }
    const value = parseInt(valueText, 10);
    
    if (isNaN(value) || value < 0) {
      throw new Error('Invalid value');
    }

    const unit = parts[i].replace(/[^a-zA-Z]/g, '');
    if (!units.includes(unit)) {
      throw new Error(`Unknown unit: ${unit}`);
    }
  
    switch (unit) {
      case 'yd':
        totalInches += value * 36;
        break;
      case 'ft':
        totalInches += value * 12;
        break;
      case 'in':
        totalInches += value;
        break;
    }

    // Remove processed parts for future processing
    parts.splice(i, 1);
    units.splice(units.indexOf(unit), 1);
  }

  return totalInches;
}

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

  let parts = [];
  
  const units = [
    { value: 36, unit: 'yd', name: 'yard' },
    { value: 12, unit: 'ft', name: 'foot' },
    { value: 1, unit: 'in', name: 'inch' }
  ];

  for (const { value, unit, name } of units) {
    const count = Math.floor(inches / value);
    if (count > 0) {
      parts.push(`${count} ${unit}`);
      inches -= count * value;
    }
  }

  return parts.join(' ');
}

export function addSpans(first: string, second: string): string {
  const totalInches1 = parseSpan(first);
  const totalInches2 = parseSpan(second);

  const totalInches = totalInches1 + totalInches2;

  return formatSpan(totalInches);
}
```