The actual issue is that there is NOT an overload that takes an object. The object is coerced into a string BECAUSE the method can't handle accepting objects.
If {} is turned into "[object Object]", then that is overloading of what {} means. The RegExp() function should simply reject the input of {} and return an error stating that it can only take strings.
View all comments
Show parent comment
3
u/ineternet Mar 20 '24
The actual issue is that there is NOT an overload that takes an object. The object is coerced into a string BECAUSE the method can't handle accepting objects.