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

rfc: add DeepAssign #187

Open
cdaringe opened this issue Sep 18, 2023 · 1 comment
Open

rfc: add DeepAssign #187

cdaringe opened this issue Sep 18, 2023 · 1 comment

Comments

@cdaringe
Copy link

cdaringe commented Sep 18, 2023

Is your feature request related to a real problem or use-case?

When I have multiple sources of options that need to be combined,
I want to use a deepmerge,
but the resulting type is imperfect. That is, there is not currently available a generic type that properly represents a deep merging of objects with non-uniform shape.

This is a common use case exemplified by the 20million d/ls on deepmerge

Example shown in the solution below.

Describe a solution including usage in code example

functional example

Who does this impact? Who is this for?

TS users wanting to merge deep objects and get a correct type out.

Describe alternatives you've considered (optional)

  • creating explicit types and performing the nested merges manually
  • just flattening stuff and avoiding deep merging altogether
  • using a DeepPartial, then using something like zod or runtypes to reflect back the deep type at the cost of runtime perf

Additional context (optional)

n/a

@cdaringe cdaringe changed the title DeepAssign rfc: add DeepAssign Sep 18, 2023
@piotrwitek
Copy link
Owner

piotrwitek commented Sep 19, 2023

Looks useful to me, please feel free to open PR. Thanks

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

No branches or pull requests

2 participants