Skip to content

Commit

Permalink
fix: use explict return types for function that return a HKT
Browse files Browse the repository at this point in the history
this results in simpler dist types

fix #94
  • Loading branch information
RebeccaStevens committed Apr 6, 2022
1 parent 4b6b64d commit eb4183e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/deepmerge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,11 @@ function defaultMergeRecords<
MF extends DeepMergeMergeFunctionsURIs,
M,
MM extends DeepMergeBuiltInMetaData
>(values: Ts, utils: U, meta: M | undefined) {
>(
values: Ts,
utils: U,
meta: M | undefined
): DeepMergeRecordsDefaultHKT<Ts, MF, M> {
const result: Record<PropertyKey, unknown> = {};

/* eslint-disable functional/no-loop-statement, functional/no-conditional-statement -- using a loop here is more performant. */
Expand Down Expand Up @@ -464,7 +468,7 @@ function defaultMergeArrays<
Ts extends ReadonlyArray<ReadonlyArray<unknown>>,
MF extends DeepMergeMergeFunctionsURIs,
M
>(values: Ts) {
>(values: Ts): DeepMergeArraysDefaultHKT<Ts, MF, M> {
return values.flat() as DeepMergeArraysDefaultHKT<Ts, MF, M>;
}

Expand All @@ -475,7 +479,7 @@ function defaultMergeArrays<
*/
function defaultMergeSets<
Ts extends ReadonlyArray<Readonly<ReadonlySet<unknown>>>
>(values: Ts) {
>(values: Ts): DeepMergeSetsDefaultHKT<Ts> {
return new Set(getIterableOfIterables(values)) as DeepMergeSetsDefaultHKT<Ts>;
}

Expand All @@ -486,7 +490,7 @@ function defaultMergeSets<
*/
function defaultMergeMaps<
Ts extends ReadonlyArray<Readonly<ReadonlyMap<unknown, unknown>>>
>(values: Ts) {
>(values: Ts): DeepMergeMapsDefaultHKT<Ts> {
return new Map(getIterableOfIterables(values)) as DeepMergeMapsDefaultHKT<Ts>;
}

Expand Down

0 comments on commit eb4183e

Please sign in to comment.