True, many times actors who have played a certain type of character on a show that becomes immensely popular have a hard time getting other types of roles later on...they become typecast.
So, if they get chances to play the opposite and/or something completely different than what they’ve played before, they’ll usually do it. But, sometimes it’s very difficult seeing an actor you’ve loved in one role suddenly playing something completely opposite. Other times it’s kind of fun & interesting.
I’ve seen a couple of the “Dukes” actors, Angela Lansbury herself from MSW, the ‘Angels’ from Charlie’s Angels, Raymond Burr from Perry Mason, etc...all play bad guys/gals in other things. It’s strange...but kind of cool to see them do completely different things.
I’ll be honest though and say I’m not an Andy Griffith fan, as from what I understand he was not that nice in real life...but, again I have to remind myself that these folks are not really the characters they play. They were/are actors. Arnold Schwarzenegger is hilarious in Kindergarten Cop (1990) , by the way. But, I usually prefer his more serious action roles.