Complete worked example
typescript
type ToArray<T> = T extends unknown ? T[] : never;
type WholeArray<T> = [T] extends [unknown] ? T[] : never;
const separate: ToArray<string | number> = [1, 2];
const mixed: WholeArray<string | number> = [1, "two"];- Reasoning
- The naked parameter distributes; tuple wrapping asks about the union as one type.