Skip to content

Instantly share code, notes, and snippets.

@lordlycastle
Created February 3, 2021 08:54
Show Gist options
  • Save lordlycastle/5d90a1dbfccee8e0d3db43d4d3f48cfd to your computer and use it in GitHub Desktop.
Save lordlycastle/5d90a1dbfccee8e0d3db43d4d3f48cfd to your computer and use it in GitHub Desktop.
function propertyOverwriteToOverwriteFunction1<T>(
overwrite: DeepPartial<T>
): (defaultData: T) => T {
return defaultData => lodash.merge({}, defaultData, overwrite);
}
function propertyOverwriteToOverwriteFunction2<T>(
overwrite: T
): <A extends T>(defaultData: A) => A {
return defaultData => lodash.merge({}, defaultData, overwrite);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment