Skip to content
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

Add default generic to DeepMergeMergeFunctionUtils #304

Closed
RebeccaStevens opened this issue Mar 18, 2023 · 2 comments
Closed

Add default generic to DeepMergeMergeFunctionUtils #304

RebeccaStevens opened this issue Mar 18, 2023 · 2 comments
Labels
Status: Released on Next It's now live on the next branch. Status: Released It's now live. Type: Enhancement Enhancement of the code, not introducing new features.

Comments

@RebeccaStevens
Copy link
Owner

Suggestion

Have DeepMergeBuiltInMetaData be the default generic for the MM generic in DeepMergeMergeFunctionUtils so that it doesn't need to be explicitly stated.

type Meta = {
  // ...
};

export const myMerge = deepmergeCustom<{}, Meta>({
  metaDataUpdater: (previousMeta, metaMeta): Meta => {
      // ...
  },
  mergeOthers(values, utils, meta): unknown {
    if (someCondition(meta)) {
      return doCustomMerge(values, utils);
    }

    return utils.actions.defaultMerge;
  },
});

function doCustomMerge(
  values: ReadonlyArray<unknown>,
  utils: DeepMergeMergeFunctionUtils<Meta, DeepMergeBuiltInMetaData> // <-- Shouldn't need to specify `DeepMergeBuiltInMetaData`
): unknown {
  // ...
}
@RebeccaStevens RebeccaStevens added the Type: Enhancement Enhancement of the code, not introducing new features. label Mar 18, 2023
github-actions bot pushed a commit that referenced this issue Mar 18, 2023
# [5.0.0-next.4](v5.0.0-next.3...v5.0.0-next.4) (2023-03-18)

### Bug Fixes

* remove unneeded eslint disable ([be28290](be28290))
* use default MM generics ([944b428](944b428)), closes [#304](#304)
@github-actions
Copy link

🎉 This issue has been resolved in version 5.0.0-next.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the Status: Released on Next It's now live on the next branch. label Mar 18, 2023
github-actions bot pushed a commit that referenced this issue Mar 18, 2023
# [5.0.0](v4.3.0...v5.0.0) (2023-03-18)

### Bug Fixes

* add missing dev dep ([df4add2](df4add2))
* remove unneeded eslint disable ([be28290](be28290))
* use default MM generics ([944b428](944b428)), closes [#304](#304)

### chore

* drop support for node 12 and 14 ([77016f7](77016f7))

### BREAKING CHANGES

* drop support for node 12 and 14
@github-actions
Copy link

🎉 This issue has been resolved in version 5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the Status: Released It's now live. label Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Released on Next It's now live on the next branch. Status: Released It's now live. Type: Enhancement Enhancement of the code, not introducing new features.
Projects
None yet
Development

No branches or pull requests

1 participant