export function mergeDefaults<T>(
  props: T,
  defaults: Partial<T>,
  allFalsyValues = false,
): T {
  const output = { ...props };
  for (const key in defaults) {
    const value = props[key];
    if (allFalsyValues && !value) {
      output[key] = defaults[key] as any;
    } else if (value === undefined || value === null) {
      output[key] = defaults[key] as any;
    }
  }
  return output;
}
