Skip to content

Conversation

@unadlib
Copy link
Owner

@unadlib unadlib commented Sep 5, 2024

#54

@github-actions
Copy link

github-actions bot commented May 4, 2025

Coverage after merging api/apply into main will be

100.00%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
index.ts100%100%100%100%
src
   apply.ts100%100%100%100%
   constant.ts100%100%100%100%
   create.ts100%100%100%100%
   current.ts100%100%100%100%
   draft.ts100%100%100%100%
   draftify.ts100%100%100%100%
   index.ts100%100%100%100%
   interface.ts100%100%100%100%
   internal.ts100%100%100%100%
   makeCreator.ts100%100%100%100%
   map.ts100%100%100%100%
   original.ts100%100%100%100%
   patch.ts100%100%100%100%
   rawReturn.ts100%100%100%100%
   set.ts100%100%100%100%
   unsafe.ts100%100%100%100%
src/utils
   cast.ts100%100%100%100%
   copy.ts100%100%100%100%
   deepFreeze.ts100%100%100%100%
   draft.ts100%100%100%100%
   finalize.ts100%100%100%100%
   forEach.ts100%100%100%100%
   index.ts100%100%100%100%
   mark.ts100%100%100%100%
   marker.ts100%100%100%100%
   proto.ts100%100%100%100%

@unadlib unadlib requested a review from Copilot May 4, 2025 13:43
Copy link

Copilot AI left a 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) => {

@github-actions
Copy link

github-actions bot commented May 5, 2025

Coverage after merging api/apply into main will be

100.00%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
index.ts100%100%100%100%
src
   apply.ts100%100%100%100%
   constant.ts100%100%100%100%
   create.ts100%100%100%100%
   current.ts100%100%100%100%
   draft.ts100%100%100%100%
   draftify.ts100%100%100%100%
   index.ts100%100%100%100%
   interface.ts100%100%100%100%
   internal.ts100%100%100%100%
   makeCreator.ts100%100%100%100%
   map.ts100%100%100%100%
   original.ts100%100%100%100%
   patch.ts100%100%100%100%
   rawReturn.ts100%100%100%100%
   set.ts100%100%100%100%
   unsafe.ts100%100%100%100%
src/utils
   cast.ts100%100%100%100%
   copy.ts100%100%100%100%
   deepFreeze.ts100%100%100%100%
   draft.ts100%100%100%100%
   finalize.ts100%100%100%100%
   forEach.ts100%100%100%100%
   index.ts100%100%100%100%
   mark.ts100%100%100%100%
   marker.ts100%100%100%100%
   proto.ts100%100%100%100%

@unadlib unadlib merged commit b185652 into main May 5, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants