```ts

/**
 * Encodes a string by repeating consecutive characters.
 * Example:
 * runLengthEncode("aaabbc") returns "a3b2c1"
 * runLengthEncode("abc") returns "a1b1c1"
 * runLengthEncode("") returns ""
 */

export function runLengthEncode(input: string): string {
  if (typeof input !== 'string') {
    throw new Error('Argument must be a string');
  }

  let encoded = '';
  for (let i = 0; i < input.length; i++) {
    const count = 1;
    while ((i + count) < input.length && input[i] === input[i + count]) {
      count++;
    }
    encoded += `${input[i]}${count > 9 ? count : count.toString()}`;
  }

  return encoded || '';
}
```