Created
December 29, 2020 17:32
-
-
Save aleksejkozin/768f3703e6e92d349ae91ce8c9e803e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {merge, cloneDeep} from 'lodash' | |
export type DeepPartial<T> = T extends object | |
? {[K in keyof T]?: DeepPartial<T[K]>} | |
: T | |
export function mergeRegardType<T>(object: T, source: DeepPartial<T>): T { | |
return merge(cloneDeep(object), source) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment