Skip to content

Commit

Permalink
Finetune the types
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterwigboldus-visma committed Oct 10, 2024
1 parent 6a686bf commit 3be4365
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 83 deletions.
154 changes: 79 additions & 75 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@trojs/deep-merge",
"description": "Object deep merge",
"version": "0.4.5",
"version": "0.4.6",
"author": {
"name": "Pieter Wigboldus",
"url": "https://trojs.org/"
Expand Down Expand Up @@ -59,4 +59,4 @@
"type": "github",
"url": "https://github.com/sponsors/w3nl"
}
}
}
7 changes: 4 additions & 3 deletions src/deep-merge.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/**
* Deep merge objects
* @param {any} objects - Objects to merge
* @returns {object} New object with merged key/values
* Deeply merges multiple objects into one.
* @template {object} [T=object]
* @param {...any} objects - Objects to merge
* @returns {T} New object with merged key/values
*/
export const deepMerge = (...objects) => {
const isObject = (obj) => obj?.constructor === Object;
Expand Down
11 changes: 8 additions & 3 deletions src/schema.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
export function deepMerge(
...objects: object[]
): object;
/**
* @template {object} [T=object]
* @param {...any} objects - Objects to merge
* @returns {T} New object with merged key/values
*/
export function deepMerge<T extends object = object>(
...objects: any[]
): T;

0 comments on commit 3be4365

Please sign in to comment.