[CDAP-1057] Improved type check so type can be reused