From 3a812eedb65cbf89d32a4175605c6c4dec0b02d9 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 18 Mar 2023 12:56:38 +0000 Subject: [PATCH] chore(release): 5.0.0-next.4 [skip ci] # [5.0.0-next.4](https://github.com/RebeccaStevens/deepmerge-ts/compare/v5.0.0-next.3...v5.0.0-next.4) (2023-03-18) ### Bug Fixes * remove unneeded eslint disable ([be28290](https://github.com/RebeccaStevens/deepmerge-ts/commit/be28290a3efb533ab339ef88e297b3e057708603)) * use default MM generics ([944b428](https://github.com/RebeccaStevens/deepmerge-ts/commit/944b428e3779904c32d071a2761753872ab717f4)), closes [#304](https://github.com/RebeccaStevens/deepmerge-ts/issues/304) --- CHANGELOG.md | 8 ++++++++ dist/deno/deepmerge-into.ts | 17 ++++++++++------- dist/deno/deepmerge.ts | 17 ++++++++++------- dist/deno/defaults/into.ts | 2 +- dist/deno/defaults/vanilla.ts | 2 +- dist/deno/types/options.ts | 25 ++++++++++++------------- dist/node/types/current/index.d.cts | 22 +++++++++++----------- dist/node/types/current/index.d.mts | 22 +++++++++++----------- 8 files changed, 64 insertions(+), 51 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 712c1144..b5e0f903 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ # Changelog All notable changes to this project will be documented in this file. Dates are displayed in UTC. +# [5.0.0-next.4](https://github.com/RebeccaStevens/deepmerge-ts/compare/v5.0.0-next.3...v5.0.0-next.4) (2023-03-18) + + +### Bug Fixes + +* remove unneeded eslint disable ([be28290](https://github.com/RebeccaStevens/deepmerge-ts/commit/be28290a3efb533ab339ef88e297b3e057708603)) +* use default MM generics ([944b428](https://github.com/RebeccaStevens/deepmerge-ts/commit/944b428e3779904c32d071a2761753872ab717f4)), closes [#304](https://github.com/RebeccaStevens/deepmerge-ts/issues/304) + # [5.0.0-next.3](https://github.com/RebeccaStevens/deepmerge-ts/compare/v5.0.0-next.2...v5.0.0-next.3) (2023-03-18) diff --git a/dist/deno/deepmerge-into.ts b/dist/deno/deepmerge-into.ts index b1e3cc0d..e4519fab 100644 --- a/dist/deno/deepmerge-into.ts +++ b/dist/deno/deepmerge-into.ts @@ -140,7 +140,10 @@ export function deepmergeIntoCustom< * * @param options - The options the user specified */ -function getIntoUtils( +function getIntoUtils< + M, + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData +>( options: DeepMergeIntoOptions, customizedDeepmergeInto: DeepMergeMergeIntoFunctionUtils< M, @@ -183,7 +186,7 @@ export function mergeUnknownsInto< Ts extends ReadonlyArray, U extends DeepMergeMergeIntoFunctionUtils, M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData >( m_target: Reference, values: Ts, @@ -262,7 +265,7 @@ export function mergeUnknownsInto< function mergeRecordsInto< U extends DeepMergeMergeIntoFunctionUtils, M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData >( m_target: Reference>, values: ReadonlyArray>>, @@ -295,7 +298,7 @@ function mergeRecordsInto< function mergeArraysInto< U extends DeepMergeMergeIntoFunctionUtils, M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData >( m_target: Reference, values: ReadonlyArray>, @@ -323,7 +326,7 @@ function mergeArraysInto< function mergeSetsInto< U extends DeepMergeMergeIntoFunctionUtils, M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData >( m_target: Reference>, values: ReadonlyArray>>, @@ -346,7 +349,7 @@ function mergeSetsInto< function mergeMapsInto< U extends DeepMergeMergeIntoFunctionUtils, M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData >( m_target: Reference>, values: ReadonlyArray>>, @@ -369,7 +372,7 @@ function mergeMapsInto< function mergeOthersInto< U extends DeepMergeMergeIntoFunctionUtils, M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData >( m_target: Reference, values: ReadonlyArray, diff --git a/dist/deno/deepmerge.ts b/dist/deno/deepmerge.ts index 87582b07..92fd8677 100644 --- a/dist/deno/deepmerge.ts +++ b/dist/deno/deepmerge.ts @@ -108,7 +108,10 @@ export function deepmergeCustom< * * @param options - The options the user specified */ -function getUtils( +function getUtils< + M, + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData +>( options: DeepMergeOptions, customizedDeepmerge: DeepMergeMergeFunctionUtils["deepmerge"] ): DeepMergeMergeFunctionUtils { @@ -147,7 +150,7 @@ export function mergeUnknowns< U extends DeepMergeMergeFunctionUtils, MF extends DeepMergeMergeFunctionsURIs, M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData >(values: Ts, utils: U, meta: M | undefined): DeepMergeHKT { if (values.length === 0) { return undefined as DeepMergeHKT; @@ -230,7 +233,7 @@ function mergeRecords< U extends DeepMergeMergeFunctionUtils, MF extends DeepMergeMergeFunctionsURIs, M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData >( values: ReadonlyArray>>, utils: U, @@ -265,7 +268,7 @@ function mergeRecords< function mergeArrays< U extends DeepMergeMergeFunctionUtils, M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData >( values: ReadonlyArray>>, utils: U, @@ -293,7 +296,7 @@ function mergeArrays< function mergeSets< U extends DeepMergeMergeFunctionUtils, M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData >( values: ReadonlyArray>>, utils: U, @@ -320,7 +323,7 @@ function mergeSets< function mergeMaps< U extends DeepMergeMergeFunctionUtils, M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData >( values: ReadonlyArray>>, utils: U, @@ -347,7 +350,7 @@ function mergeMaps< function mergeOthers< U extends DeepMergeMergeFunctionUtils, M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData >(values: ReadonlyArray, utils: U, meta: M | undefined) { const result = utils.mergeFunctions.mergeOthers(values, utils, meta); diff --git a/dist/deno/defaults/into.ts b/dist/deno/defaults/into.ts index 9b11c340..864a39fe 100644 --- a/dist/deno/defaults/into.ts +++ b/dist/deno/defaults/into.ts @@ -31,7 +31,7 @@ export function mergeRecords< Ts extends ReadonlyArray>, U extends DeepMergeMergeIntoFunctionUtils, M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData >( m_target: Reference>, values: Ts, diff --git a/dist/deno/defaults/vanilla.ts b/dist/deno/defaults/vanilla.ts index daf05131..549cb7f7 100644 --- a/dist/deno/defaults/vanilla.ts +++ b/dist/deno/defaults/vanilla.ts @@ -36,7 +36,7 @@ export function mergeRecords< U extends DeepMergeMergeFunctionUtils, MF extends DeepMergeMergeFunctionsURIs, M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData >( values: Ts, utils: U, diff --git a/dist/deno/types/options.ts b/dist/deno/types/options.ts index 58be1983..67e0fa87 100644 --- a/dist/deno/types/options.ts +++ b/dist/deno/types/options.ts @@ -1,7 +1,6 @@ import type { MergeFunctions as MergeIntoFunctions } from "../defaults/into.ts"; import type { MergeFunctions } from "../defaults/vanilla.ts"; -// eslint-disable-next-line import/no-relative-parent-imports -- use "deepmerge-ts" once denoify can support it. import type { DeepMergeBuiltInMetaData } from "./merging.ts"; /** @@ -9,7 +8,7 @@ import type { DeepMergeBuiltInMetaData } from "./merging.ts"; */ export type DeepMergeOptions< in out M, - MM extends Readonly> = DeepMergeBuiltInMetaData + MM extends Readonly> = {} > = Partial>; /** @@ -17,20 +16,20 @@ export type DeepMergeOptions< */ export type DeepMergeIntoOptions< in out M, - MM extends Readonly> = DeepMergeBuiltInMetaData + MM extends Readonly> = {} > = Partial>; -type MetaDataUpdater = ( - previousMeta: M | undefined, - metaMeta: Readonly> -) => M; +type MetaDataUpdater< + in out M, + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData +> = (previousMeta: M | undefined, metaMeta: Readonly>) => M; /** * All the options the user can pass to customize deepmerge. */ type DeepMergeOptionsFull< in out M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData > = Readonly<{ mergeRecords: DeepMergeMergeFunctions["mergeRecords"] | false; mergeArrays: DeepMergeMergeFunctions["mergeArrays"] | false; @@ -46,7 +45,7 @@ type DeepMergeOptionsFull< */ type DeepMergeIntoOptionsFull< in out M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData > = Readonly<{ mergeRecords: DeepMergeMergeIntoFunctions["mergeRecords"] | false; mergeArrays: DeepMergeMergeIntoFunctions["mergeArrays"] | false; @@ -68,7 +67,7 @@ export type Reference = { */ type DeepMergeMergeFunctions< in M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData > = Readonly<{ mergeRecords: < Ts extends ReadonlyArray>>, @@ -124,7 +123,7 @@ type DeepMergeMergeIntoFunctionsReturnType = void | symbol; */ type DeepMergeMergeIntoFunctions< in M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData > = Readonly<{ mergeRecords: < Ts extends ReadonlyArray>>, @@ -183,7 +182,7 @@ type DeepMergeMergeIntoFunctions< // eslint-disable-next-line functional/no-mixed-types export type DeepMergeMergeFunctionUtils< in out M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData > = Readonly<{ mergeFunctions: DeepMergeMergeFunctions; defaultMergeFunctions: MergeFunctions; @@ -202,7 +201,7 @@ export type DeepMergeMergeFunctionUtils< // eslint-disable-next-line functional/no-mixed-types export type DeepMergeMergeIntoFunctionUtils< in out M, - MM extends DeepMergeBuiltInMetaData + MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData > = Readonly<{ mergeFunctions: DeepMergeMergeIntoFunctions; defaultMergeFunctions: MergeIntoFunctions; diff --git a/dist/node/types/current/index.d.cts b/dist/node/types/current/index.d.cts index cae0c6e9..972f08a8 100644 --- a/dist/node/types/current/index.d.cts +++ b/dist/node/types/current/index.d.cts @@ -325,7 +325,7 @@ type MergeFunctions$1 = { * @param m_target - The result will be mutated into this record * @param values - The records (including the target's value if there is one). */ -declare function mergeRecords$1>, U extends DeepMergeMergeIntoFunctionUtils, M, MM extends DeepMergeBuiltInMetaData>(m_target: Reference>, values: Ts, utils: U, meta: M | undefined): void; +declare function mergeRecords$1>, U extends DeepMergeMergeIntoFunctionUtils, M, MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData>(m_target: Reference>, values: Ts, utils: U, meta: M | undefined): void; /** * The default strategy to merge arrays into a target array. * @@ -367,7 +367,7 @@ type MergeFunctions = { * * @param values - The records. */ -declare function mergeRecords>, U extends DeepMergeMergeFunctionUtils, MF extends DeepMergeMergeFunctionsURIs, M, MM extends DeepMergeBuiltInMetaData>(values: Ts, utils: U, meta: M | undefined): DeepMergeRecordsDefaultHKT; +declare function mergeRecords>, U extends DeepMergeMergeFunctionUtils, MF extends DeepMergeMergeFunctionsURIs, M, MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData>(values: Ts, utils: U, meta: M | undefined): DeepMergeRecordsDefaultHKT; /** * The default strategy to merge arrays. * @@ -394,16 +394,16 @@ declare function mergeOthers>(values: Ts): unk /** * The options the user can pass to customize deepmerge. */ -type DeepMergeOptions> = DeepMergeBuiltInMetaData> = Partial>; +type DeepMergeOptions> = {}> = Partial>; /** * The options the user can pass to customize deepmergeInto. */ -type DeepMergeIntoOptions> = DeepMergeBuiltInMetaData> = Partial>; -type MetaDataUpdater = (previousMeta: M | undefined, metaMeta: Readonly>) => M; +type DeepMergeIntoOptions> = {}> = Partial>; +type MetaDataUpdater = (previousMeta: M | undefined, metaMeta: Readonly>) => M; /** * All the options the user can pass to customize deepmerge. */ -type DeepMergeOptionsFull = Readonly<{ +type DeepMergeOptionsFull = Readonly<{ mergeRecords: DeepMergeMergeFunctions["mergeRecords"] | false; mergeArrays: DeepMergeMergeFunctions["mergeArrays"] | false; mergeMaps: DeepMergeMergeFunctions["mergeMaps"] | false; @@ -415,7 +415,7 @@ type DeepMergeOptionsFull = Reado /** * All the options the user can pass to customize deepmergeInto. */ -type DeepMergeIntoOptionsFull = Readonly<{ +type DeepMergeIntoOptionsFull = Readonly<{ mergeRecords: DeepMergeMergeIntoFunctions["mergeRecords"] | false; mergeArrays: DeepMergeMergeIntoFunctions["mergeArrays"] | false; mergeMaps: DeepMergeMergeIntoFunctions["mergeMaps"] | false; @@ -432,7 +432,7 @@ type Reference = { /** * All the merge functions that deepmerge uses. */ -type DeepMergeMergeFunctions = Readonly<{ +type DeepMergeMergeFunctions = Readonly<{ mergeRecords: >>, U extends DeepMergeMergeFunctionUtils>(values: Ts, utils: U, meta: M | undefined) => unknown; mergeArrays: >, U extends DeepMergeMergeFunctionUtils>(values: Ts, utils: U, meta: M | undefined) => unknown; mergeMaps: >>, U extends DeepMergeMergeFunctionUtils>(values: Ts, utils: U, meta: M | undefined) => unknown; @@ -443,7 +443,7 @@ type DeepMergeMergeIntoFunctionsReturnType = void | symbol; /** * All the merge functions that deepmerge uses. */ -type DeepMergeMergeIntoFunctions = Readonly<{ +type DeepMergeMergeIntoFunctions = Readonly<{ mergeRecords: >>, U extends DeepMergeMergeIntoFunctionUtils>(m_target: Reference>, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType; mergeArrays: >, U extends DeepMergeMergeIntoFunctionUtils>(m_target: Reference, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType; mergeMaps: >>, U extends DeepMergeMergeIntoFunctionUtils>(m_target: Reference>, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType; @@ -453,7 +453,7 @@ type DeepMergeMergeIntoFunctions = Re /** * The utils provided to the merge functions. */ -type DeepMergeMergeFunctionUtils = Readonly<{ +type DeepMergeMergeFunctionUtils = Readonly<{ mergeFunctions: DeepMergeMergeFunctions; defaultMergeFunctions: MergeFunctions; metaDataUpdater: MetaDataUpdater; @@ -467,7 +467,7 @@ type DeepMergeMergeFunctionUtils /** * The utils provided to the merge functions. */ -type DeepMergeMergeIntoFunctionUtils = Readonly<{ +type DeepMergeMergeIntoFunctionUtils = Readonly<{ mergeFunctions: DeepMergeMergeIntoFunctions; defaultMergeFunctions: MergeFunctions$1; metaDataUpdater: MetaDataUpdater; diff --git a/dist/node/types/current/index.d.mts b/dist/node/types/current/index.d.mts index cae0c6e9..972f08a8 100644 --- a/dist/node/types/current/index.d.mts +++ b/dist/node/types/current/index.d.mts @@ -325,7 +325,7 @@ type MergeFunctions$1 = { * @param m_target - The result will be mutated into this record * @param values - The records (including the target's value if there is one). */ -declare function mergeRecords$1>, U extends DeepMergeMergeIntoFunctionUtils, M, MM extends DeepMergeBuiltInMetaData>(m_target: Reference>, values: Ts, utils: U, meta: M | undefined): void; +declare function mergeRecords$1>, U extends DeepMergeMergeIntoFunctionUtils, M, MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData>(m_target: Reference>, values: Ts, utils: U, meta: M | undefined): void; /** * The default strategy to merge arrays into a target array. * @@ -367,7 +367,7 @@ type MergeFunctions = { * * @param values - The records. */ -declare function mergeRecords>, U extends DeepMergeMergeFunctionUtils, MF extends DeepMergeMergeFunctionsURIs, M, MM extends DeepMergeBuiltInMetaData>(values: Ts, utils: U, meta: M | undefined): DeepMergeRecordsDefaultHKT; +declare function mergeRecords>, U extends DeepMergeMergeFunctionUtils, MF extends DeepMergeMergeFunctionsURIs, M, MM extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData>(values: Ts, utils: U, meta: M | undefined): DeepMergeRecordsDefaultHKT; /** * The default strategy to merge arrays. * @@ -394,16 +394,16 @@ declare function mergeOthers>(values: Ts): unk /** * The options the user can pass to customize deepmerge. */ -type DeepMergeOptions> = DeepMergeBuiltInMetaData> = Partial>; +type DeepMergeOptions> = {}> = Partial>; /** * The options the user can pass to customize deepmergeInto. */ -type DeepMergeIntoOptions> = DeepMergeBuiltInMetaData> = Partial>; -type MetaDataUpdater = (previousMeta: M | undefined, metaMeta: Readonly>) => M; +type DeepMergeIntoOptions> = {}> = Partial>; +type MetaDataUpdater = (previousMeta: M | undefined, metaMeta: Readonly>) => M; /** * All the options the user can pass to customize deepmerge. */ -type DeepMergeOptionsFull = Readonly<{ +type DeepMergeOptionsFull = Readonly<{ mergeRecords: DeepMergeMergeFunctions["mergeRecords"] | false; mergeArrays: DeepMergeMergeFunctions["mergeArrays"] | false; mergeMaps: DeepMergeMergeFunctions["mergeMaps"] | false; @@ -415,7 +415,7 @@ type DeepMergeOptionsFull = Reado /** * All the options the user can pass to customize deepmergeInto. */ -type DeepMergeIntoOptionsFull = Readonly<{ +type DeepMergeIntoOptionsFull = Readonly<{ mergeRecords: DeepMergeMergeIntoFunctions["mergeRecords"] | false; mergeArrays: DeepMergeMergeIntoFunctions["mergeArrays"] | false; mergeMaps: DeepMergeMergeIntoFunctions["mergeMaps"] | false; @@ -432,7 +432,7 @@ type Reference = { /** * All the merge functions that deepmerge uses. */ -type DeepMergeMergeFunctions = Readonly<{ +type DeepMergeMergeFunctions = Readonly<{ mergeRecords: >>, U extends DeepMergeMergeFunctionUtils>(values: Ts, utils: U, meta: M | undefined) => unknown; mergeArrays: >, U extends DeepMergeMergeFunctionUtils>(values: Ts, utils: U, meta: M | undefined) => unknown; mergeMaps: >>, U extends DeepMergeMergeFunctionUtils>(values: Ts, utils: U, meta: M | undefined) => unknown; @@ -443,7 +443,7 @@ type DeepMergeMergeIntoFunctionsReturnType = void | symbol; /** * All the merge functions that deepmerge uses. */ -type DeepMergeMergeIntoFunctions = Readonly<{ +type DeepMergeMergeIntoFunctions = Readonly<{ mergeRecords: >>, U extends DeepMergeMergeIntoFunctionUtils>(m_target: Reference>, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType; mergeArrays: >, U extends DeepMergeMergeIntoFunctionUtils>(m_target: Reference, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType; mergeMaps: >>, U extends DeepMergeMergeIntoFunctionUtils>(m_target: Reference>, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType; @@ -453,7 +453,7 @@ type DeepMergeMergeIntoFunctions = Re /** * The utils provided to the merge functions. */ -type DeepMergeMergeFunctionUtils = Readonly<{ +type DeepMergeMergeFunctionUtils = Readonly<{ mergeFunctions: DeepMergeMergeFunctions; defaultMergeFunctions: MergeFunctions; metaDataUpdater: MetaDataUpdater; @@ -467,7 +467,7 @@ type DeepMergeMergeFunctionUtils /** * The utils provided to the merge functions. */ -type DeepMergeMergeIntoFunctionUtils = Readonly<{ +type DeepMergeMergeIntoFunctionUtils = Readonly<{ mergeFunctions: DeepMergeMergeIntoFunctions; defaultMergeFunctions: MergeFunctions$1; metaDataUpdater: MetaDataUpdater;