from typing import List


def to_lines(s: str) -> List[str]:
    """
    Like `str.splitlines()`, except that an empty string results in a
    one-element list and a trailing newline results in a trailing empty string
    (and all without re-implementing Python's changing line-splitting
    algorithm).
    """
    lines = s.splitlines(True)
    if not lines:
        return [""]
    if lines[-1].splitlines() != [lines[-1]]:
        lines.append("")
    for i, ln in enumerate(lines):
        l2 = ln.splitlines()
        assert len(l2) in (0, 1)
        lines[i] = l2[0] if l2 else ""
    return lines