-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RegExp.prototype.exec() and test() parameters are optional #37211
Comments
It runs without errors but it's certainly a mistake. |
While it works in JS, JS also has no problems with Just use |
I proposed this because I had an issue when using an optional chain: I'm wondering if that's intended. I could live with it, but I think it's an aspect where TS feels more challenging. |
Like @IllusionMH suggested, you might as well write |
I guess you are right. |
TypeScript Version:
3.8.3
Search Terms:
RegExp
Code
Expected behavior:
Compiles.
Actual behavior:
Doesn't compile due to an expected argument for
exec
in line 8. But the corresponding JavaScript code runs without error.Playground Link:
http://www.typescriptlang.org/play/?ssl=8&ssc=29&pln=1&pc=1#code/JYWwDg9gTgLgBAKjgQwM4tagprOAzKCEOAcjW1hIG4BYAKHoBst4RkYBjACy3QF44AemQAjABQcAlIIB0WAB5YOYsiI4lJtOuRwwZEANZiAglCjIAnjOCpT5i2LaceqSZvo7YcgI4BXZIxijuzcvBhwAEpYAOYAovJg8Up2lpIyzAB20TBcADRwAEzuDHROofxCohLScorKxZ56WH4Bwc68+Rm+jIyaQA
Related Issues:
Did not find other bugs that looked similar.
The text was updated successfully, but these errors were encountered: