```ts
// solution.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);
  if (trimmed.length === line.length) {
    return trimmed;
  } else {
    const dotIndex = trimmed.lastIndexOf('.');
    return dotIndex > -1 ? trimmed.slice(0, dotIndex + 3) : trimmed;
  }
}
```