-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
allow regex literals and const regexes/strings to be used when overloading string constants #1328
Comments
I'm not sure how well this would play with the resulting signature help for these overloads compared to the explicit version that you have to write today. I'm not following what you mean with the last sentence about using the same constant in the implementation. |
You might also be interested in #1003 instead. |
@DanielRosenwasser If you could define a type as being @danquirk Some code will probably explain things better:
The thought was that the regex could be by both the type system and also by the code. |
When ES7 specification come into force, you will find it include the support for overloading. |
Motivation:
I'm working on a small event simulation library. I'd like to overload the
simulate
function so I'm doing the following:Suggestion:
It would be nice if we could allow regex literals or const regexes to be used in the place of string literals when overloading functions as shown below:
Since there is no "const" yet maybe we could start with regex literals. The nice thing about allowing constants is that you could then use the same constant in the code in a switch statement or if-else block.
The text was updated successfully, but these errors were encountered: