check type consistency with checkType