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

use recursive partial for type definitions #240

Closed
jonnytest1 opened this issue Nov 3, 2021 · 1 comment
Closed

use recursive partial for type definitions #240

jonnytest1 opened this issue Nov 3, 2021 · 1 comment

Comments

@jonnytest1
Copy link

export type RecursivePartial<T> = {
  [P in keyof T]?: T[P] extends (infer U)[]
    ? RecursivePartial<U>[]
    : T[P] extends object
      ? RecursivePartial<T[P]>
      : T[P];
};

this way subobjects can also be partial but need to have the correct types if provided

@RebeccaStevens
Copy link

The Partial type is planned to be removed completely in the next version (whenever that may happen). A much more in-depth merging is planned.

See #226, specifically the types.ts file for more details.
However, the typings there may be a little out of date now. See this alternative for the latest work on the typings (currently release as deepmerge-ts)

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