```ts
export function trimTo(line: string, limit: number): string {
  if (limit < 4) {
    throw new Error("Limit must be at least 4");
  }

  const trimmed = line.slice(0, limit - 3);
  return trimmed + "...";
}
```