```ts
/**
 * Safely divides `a` by `b`.
 * Throws an Error if `b` is zero or negative infinity.
 * Throws an Error unless both arguments are finite numbers.
 * @param a The dividend.
 * @param b The divisor.
 * @returns The result of dividing `a` by `b`.
 */
export function safeDivide(a: number, b: number): number {
  if (typeof a !== 'number' || typeof b !== 'number') {
    throw new Error('Both arguments must be numbers.');
  }
  if (!isFinite(a) || !isFinite(b)) {
    throw new Error('Both arguments must be finite numbers.');
  }
  if (b === 0 || b === -Infinity) {
    throw new Error('Divisor cannot be zero or negative infinity.');
  }
  return a / b;
}
```