79418723

Date: 2025-02-06 16:55:30
Score: 2
Natty:
Report link

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.

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • User mentioned (1): @jcalz
  • Low reputation (1):
Posted by: KuSh