You can simplify AtLeastTwoElements from @jcalz answer to
type AtLeastTwoElements<K extends PropertyKey> =
{ [P in K]: Exclude<K, P> }[K]
AtLeastTwoElements<"a" | "b">
evaluates to {a: "b", b: "a"}["a" | "b"]
which is "a" | "b"
.
But AtLeastTwoElements<"a">
is {a: never}["a"]
which is never
.