Use type checking to detect an errant closure