/** * Assigns own enumerable properties of `source` onto `target` only where `target[key] === undefined` * (lodash `defaults` semantics). */ export function assignDefaults>( target: T, source: Record, ): void { for (const key of Object.keys(source)) { if (target[key] === undefined) { (target as Record)[key] = source[key]; } } }