fix type of deepMerge

This commit is contained in:
Hazelnoot 2024-11-01 18:33:06 -04:00
parent ca94959fff
commit 194bc20af1

View file

@ -18,7 +18,7 @@ function isPureObject(value: unknown): value is Record<string | number | symbol,
* valueにないキーをdefからもらう\
* nullはそのままundefinedはdefの値
**/
export function deepMerge<X extends Record<string | number | symbol, unknown>>(value: DeepPartial<X>, def: X): X {
export function deepMerge<X extends object>(value: DeepPartial<X>, def: X): X {
if (isPureObject(value) && isPureObject(def)) {
const result = deepClone(value as Cloneable) as X;
for (const [k, v] of Object.entries(def) as [keyof X, X[keyof X]][]) {