Skip to content

Commit

Permalink
Merge pull request #40 from ShravanSunder/production
Browse files Browse the repository at this point in the history
Added const modfier on type parameters so that merge will infer const types.  Also updated typescript
  • Loading branch information
mesqueeb authored Feb 8, 2025
2 parents 5c160f4 + c15ef78 commit 53aac29
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ function mergeRecursively<T1, T2>(
* Objects get merged, special objects (classes etc.) are re-assigned "as is".
* Basic types overwrite objects or other basic types.
*/
export function merge<T, Tn extends unknown[]>(object: T, ...otherObjects: Tn): Merge<T, Tn> {
export function merge<T, const Tn extends unknown[]>(object: T, ...otherObjects: Tn): Merge<T, Tn> {
return otherObjects.reduce((result, newComer) => {
return mergeRecursively(result, newComer)
}, object) as any
}

export function mergeAndCompare<T, Tn extends unknown[]>(
export function mergeAndCompare<T, const Tn extends unknown[]>(
compareFn: (prop1: unknown, prop2: unknown, propName: string | symbol) => any,
object: T,
...otherObjects: Tn
Expand All @@ -111,7 +111,7 @@ export function mergeAndCompare<T, Tn extends unknown[]>(
}, object) as any
}

export function mergeAndConcat<T, Tn extends unknown[]>(
export function mergeAndConcat<T, const Tn extends unknown[]>(
object: T,
...otherObjects: Tn
): Merge<T, Tn> {
Expand Down

0 comments on commit 53aac29

Please sign in to comment.