This is one of the things static typing is supposed to prevent in the first place. It seems like a lot of people actually want a dynamically typed language, but try to change a static language instead.