-
Notifications
You must be signed in to change notification settings - Fork 196
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
Map.get()
should throw if there is no value, and we should also offer tryGet()
#3575
Comments
Map.get
should throw if there is no value, and we should also offer tryGet()
Map.get()
should throw if there is no value, and we should also offer tryGet()
Hello! Can I work on this issue? I want to get my hands dirty with the codebase and this seems like a good starting point. |
Yes, it does make a lot of sense to start with this |
I've assigned it to you @giovanni-orciuolo , let me know if you need any help with this |
Hi @giovanni-orciuolo ! How about joining our slack channel? https://t.winglang.io/slack |
There are several open issues in progress that need to be able to define generic optionals. Such as: - #1868 - #3575 - #3653 I only added `tryAt` method for Array since the actual work is defined in another issue, but I needed an example to write some test cases with. Since there are several efforts that need this change I opted to not wait and include it in one of those PRs but just add the support here so other efforts can rebase. ## Checklist - [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [x] Description explains motivation and solution - [x] Tests added (always) - [x] Docs updated (only required for features) - [x] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
Hi, This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. |
Keep |
Includes the changes from: #3771 that giovanni did. Closes: #3575 ## Checklist - [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [x] Description explains motivation and solution - [x] Tests added (always) - [x] Docs updated (only required for features) - [x] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. Co-authored-by: Giovanni Orciuolo <giovanni@orciuolo.it> BREAKING CHANGE: `Map.get()` now throws if key does not exist.
Congrats! 🚀 This was released in Wing 0.38.0. |
I tried this:
This happened:
I expected this:
I expected this to throw.
I also expected to find
tryGet()
to returnT?
.Is there a workaround?
If we assign the result to a
T?
, it works.Component
SDK
Wing Version
No response
Node.js Version
No response
Platform(s)
No response
Anything else?
No response
Community Notes
The text was updated successfully, but these errors were encountered: