Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-deepmerge

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-deepmerge - npm Package Compare versions

Comparing version 6.2.0 to 6.2.1

24

package.json

@@ -5,3 +5,3 @@ {

"license": "ISC",
"version": "6.2.0",
"version": "6.2.1",
"scripts": {

@@ -59,17 +59,17 @@ "clean": "rimraf ./{cjs,esm}/!(package.json)",

"devDependencies": {
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"concurrently": "^8.2.0",
"@types/jest": "^29.5.11",
"@typescript-eslint/eslint-plugin": "^6.19.1",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
"eslint": "^8.45.0",
"eslint": "^8.56.0",
"eslint-config-voodoocreation": "^4.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.6.3",
"eslint-plugin-prefer-arrow": "^1.2.3",
"jest": "^29.6.1",
"jest-environment-jsdom": "^29.6.1",
"prettier": "^3.0.0",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6"
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"prettier": "^3.2.4",
"ts-jest": "^29.1.2",
"typescript": "^5.3.3"
}
}

@@ -93,1 +93,28 @@ [![npm](https://img.shields.io/npm/v/ts-deepmerge)](https://www.npmjs.com/package/ts-deepmerge)

All options have JSDoc descriptions [in its source](/index.ts#L82).
### When working with generic declared types/interfaces
There's currently a limitation with the inferred return type that `ts-deepmerge` offers, where it's
unable to take the order of the objects/properties into consideration due to the nature of accepting
an infinite number of objects to merge as args and what TypeScript currently offers to infer the types.
The primary use case for the inferred return type is for basic object primitives, to offer something
more useful as the return type, which does work for a lot of cases.
If you're working with generic declared types though, this can cause the inferred return type to not align
with what you may expect, as it currently detects every possible value and combines them as a union type.
When working with declared types, and you know what the final type will align to, simply use the `as` keyword
as shown in the example below:
```typescript
interface IObj {
a: string;
b: string;
}
const obj1: IObj = { a: "1", b: "2", };
const obj2: Partial<IObj> = { a: "1" };
const result = merge(obj1, obj2) as IObj;
```
More context can be found in [this issue](https://github.com/voodoocreation/ts-deepmerge/issues/30).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc