TypeScript Union Type and Distributive Conditional Types Part 2

I show the reason Distributive Conditional Type needs to be used for Union Type in this post.

If generic type T is passed as Union Type like string | number, then array item will be Union Type as below.

If you need to iterate on each type in Union Type, then Distributive Conditional Type (with extends keywod) needs to be used.

To avoid distributive behaviour in Distibutive Conditional Type, surround each side of extends keyword with square brackets.

keyof doesn't work with Union Type, so we have to iterate in Union Type to pick fields of each type.

When Distributive Conditional Type is used, it looks like below;

Inferring an object field type with infer keyword doesn't work for Union Type, so it shows never as below.⬇️

When Distributive Conditional Type is used, it looks like below;