Raise TypeError instead of ValueError