Deal with invalid type argument

When an invalid type argument is given, an ArgumentError should be raised.