```ts
export function digitCount(value: number): number {
  if (typeof value !== 'number') {
    throw new Error('value must be a number');
  }

  let count = 0;
  const absValue = Math.abs(value);

  if (absValue === 0) {
    return 1; // Special case: "0" written with no digits
  }

  while (absValue > 0) {
    count++;
    absValue = Math.floor(absValue / 10);
  }

  return count;
}
```