Use `cast_type` consistently