This kind of thing is the reason why Typescript exists. I do agree checking the type of the argument would most likely be way more beneficial than not doing so. Seems like whoever wrote RegExp expects ppl will read the docs and use it “properly”. Can’t really say that’s a reasonable expectation 🤷♀️
View all comments
Show parent comment
1
u/elehisie Mar 20 '24
This kind of thing is the reason why Typescript exists. I do agree checking the type of the argument would most likely be way more beneficial than not doing so. Seems like whoever wrote RegExp expects ppl will read the docs and use it “properly”. Can’t really say that’s a reasonable expectation 🤷♀️