```typescript
export function findAll(text: string, pattern: string): number[] {
  if (typeof text !== 'string' || typeof pattern !== 'string') {
    throw new Error('Both arguments must be strings');
  }
  if (pattern.length === 0) {
    throw new Error('Pattern cannot be an empty string');
  }

  const result: number[] = [];
  let position = 0;

  while (position <= text.length - pattern.length) {
    if (text.substring(position, position + pattern.length) === pattern) {
      result.push(position);
      position++; // Move one character forward to allow overlapping matches
    } else {
      position++;
    }
  }

  return result;
}
```