let's assume next type:
type Indexed<A> = A extends any[] ? A[number] : never;
type R = Indexed<[1, 2, 3, 4, 5]>
If you hover mouse in your IDE or TS playground, you will see type R = 5 | 1 | 2 | 3 | 4
5 is on the first place
If you change R to type R = Last<[1, 2, 0, 3, 5]>
, you will see type R = 0 | 5 | 1 | 2 | 3
I understand, that union type order does not matter, but:
Why union type order has changed?