diff --git a/src/options.ts b/src/options.ts index 016f4c5..f23c76e 100644 --- a/src/options.ts +++ b/src/options.ts @@ -27,7 +27,7 @@ export type FullOptions = FlattenAlias<{ readonly arrayMerge: O[`arrayMerge`] extends undefined ? typeof defaultArrayMerge : NonNullable - readonly clone: O[`clone`] extends undefined ? true : NonNullable + readonly clone: O[`clone`] extends undefined ? typeof defaultClone : NonNullable readonly customMerge?: O[`customMerge`] readonly isMergeable: O[`isMergeable`] extends undefined ? typeof defaultIsMergeable @@ -52,6 +52,8 @@ export type ObjectMerge = ( key: K ) => ((target: any, source: any, options: FullOptions) => any) | undefined +const defaultClone = true as const + function defaultIsMergeable(value: unknown): value is Record | Array { return Array.isArray(value) || isPlainObj(value) } @@ -82,7 +84,7 @@ export function getFullOptions(options?: O): FullOptions { return { arrayMerge: defaultArrayMerge, isMergeable: defaultIsMergeable, - clone: true, + clone: defaultClone, ...overrides, cloneUnlessOtherwiseSpecified, } as unknown as FullOptions