I show the reason Distributive Conditional Type needs to be used for Union Type in this post.
I show the reason Distributive Conditional Type needs to be used for Union Type in this post.
string | number
, then array item will be Union Type as below.extends
keywod) needs to be used.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.infer
keyword doesn't work for Union Type, so it shows never as below.⬇️