```typescript
export function flatten(items: readonly unknown[], depth?: number): unknown[] {
  if (depth === undefined) depth = Infinity;

  if (typeof depth !== 'number' || !Number.isInteger(depth) || depth < 0) {
    throw new Error('Depth must be a non-negative integer or Infinity');
  }

  function _flatten(items: readonly unknown[], currentDepth: number): unknown[] {
    return items.reduce((acc, item) => {
      if (currentDepth > 0 && Array.isArray(item)) {
        acc.push(..._flatten(item, currentDepth - 1));
      } else if (typeof item !== 'string') {
        acc.push(item);
      }
      return acc;
    }, [] as unknown[]);
  }

  return _flatten(items, depth);
}
```