-
Notifications
You must be signed in to change notification settings - Fork 199
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
feat(sdk): let MutArray.push() accept variadic arguments of the same … #5114
Conversation
…type as the container's element type
Signed-off-by: monada-bot[bot] <monabot@monada.co>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for contributing, @autow0rk! This PR will now be added to the merge queue, or immediately merged if |
Congrats! 🚀 This was released in Wing 0.51.11. |
Hey @autow0rk, just wanted to let you know it looks like this didn't fix #4836 |
Fixes issue in #5114 and closes #4836 Attach updated array.ts file (has updated definition for .push() on MutArray to support variadic arguments) and update snapshots Example Input: let myList: MutArray<str> = MutArray<str> ["element1"]; myList.push("element2", "element3"); Example Output: const myList = ["element1"]; ((obj, args) => { obj.push(...args); })(myList, ["element2", "element3"]); ## 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) - [ ] Docs updated (only required for features) - [ ] 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)*.
Closes #4836
For the MutArray container type, the .push() method should take a variadic type. This is implemented in the type_check.rs file, by substituting a generic variadic argument type (T1) with the container's element type when typechecking the function arguments.
Checklist
Tests added (always)Snapshots for MutArray.push() were updated, not sure if new test cases need to be added for thispr/e2e-full
label if this feature requires end-to-end testingBy submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.