-
Notifications
You must be signed in to change notification settings - Fork 27
feat: support for mutable data in apply() function #55
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
Conversation
|
Coverage after merging api/apply into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Pull Request Overview
This PR introduces support for mutable data within the apply() function and updates related types/interfaces, along with a new test case to verify mutable behavior.
- Added a new test case in test/apply.test.ts to validate mutable operations.
- Updated the type definitions in src/interface.ts to include ApplyMutableOptions and adjusted ApplyOptions and ApplyResult types.
- Modified the apply() function in src/apply.ts to handle mutable patch application.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/apply.test.ts | Adds tests to validate both immutable and mutable patch apply. |
| src/interface.ts | Introduces ApplyMutableOptions and refines ApplyOptions types. |
| src/apply.ts | Updates apply() signature to support mutable operations and adjusts internal type usage. |
Comments suppressed due to low confidence (1)
src/apply.ts:52
- [nitpick] Since the mutate function now accepts both Draft and T, consider renaming the parameter (or adding an inline comment) to clarify that it can refer to either a draft or a plain state, which will aid future maintainers in understanding the intent.
const mutate = (draft: Draft<T> | T) => {
|
Coverage after merging api/apply into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#54