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

Proposal: DeepPartialDiff #980

Open
1 task done
jonathanmorley opened this issue Nov 13, 2024 · 0 comments
Open
1 task done

Proposal: DeepPartialDiff #980

jonathanmorley opened this issue Nov 13, 2024 · 0 comments

Comments

@jonathanmorley
Copy link

jonathanmorley commented Nov 13, 2024

Type description + examples

I am unsure of the right name for a type like this, but will explain the use-case:

Given a function f, that takes an argument of type T (i.e. function f(t: T) I would like to create the following class:

import defaults from 'defaults';

class Helper<B extends PartialDeep<T>> {
  private base: B;

  constructor(base: B) {
    this.b = b;
  }

  // I want `DeepPartialDiff` to make optional anything that has been passed in the constructor, but keep required anything NOT passed in the constructor.
  runF(overrides: DeepPartialDiff<T, B>): ReturnType<typeof f> {
    return f(defaults(overrides, this.base));
  }
}

Type source

No response

Search existing types and issues first

  • I tried my best to look for it

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • The funding will be given to active contributors.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@jonathanmorley jonathanmorley changed the title DeepPartialDiff Proposal: DeepPartialDiff Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant