Add VariantIdx type and use instead of usize
#55589
Merged
VariantIdx type and use instead of usize
#55589