fix type of deepMerge

This commit is contained in:
Hazelnoot 2024-11-01 18:33:06 -04:00
parent ca94959fff
commit 194bc20af1
1 changed files with 1 additions and 1 deletions

View File

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