ProvenPin Install

deepmerge-ts nested object and array merge: working versions (tested 2026-10-15)

Deep-merge nested objects and concatenate arrays with deepmerge-ts while leaving sources untouched.

passed1 passed · 0 failed2026-10-15 20:56 UTC
Status
passed
Last passed
2026-10-15 20:56 UTC
Tests
1 / 1
Language
TypeScript
Runtime
node v22.23.3
pinned versions3
deepmerge-ts@8.0.2@types/node@26.6.5tsx@4.23.15
run it
npm install --no-audit --no-fund --ignore-scripts=false
npm test
test environment
node v22.23.3
linux 6.17.0-1022-azure
x64
runner: github-actions 38805962781

The code

Exactly the files that passed. Your agent can pull them with get_recipe("deepmerge-ts-nested") (install), or see them on GitHub.

package.json
{
  "name": "deepmerge-ts-nested",
  "private": true,
  "type": "module",
  "scripts": {
    "test": "node --import tsx --test test/*.test.ts"
  },
  "dependencies": {
    "deepmerge-ts": "8.0.2"
  },
  "devDependencies": {
    "@types/node": "26.6.5",
    "tsx": "4.23.15"
  }
}
src/merge.ts
import { deepmerge } from "deepmerge-ts";

export type Settings = {
  app: { name: string; port: number };
  features: string[];
  nested: { a: number; b?: number };
};

export function mergeSettings(...parts: Array<Partial<Settings>>) {
  return deepmerge(...parts) as Settings;
}
test/merge.test.ts
import { test } from "node:test";
import assert from "node:assert/strict";
import { mergeSettings } from "../src/merge.ts";

test("merges nested objects and concatenates arrays", () => {
  const a = { app: { name: "demo", port: 1 }, features: ["a"], nested: { a: 1 } };
  const b = { app: { port: 99 }, features: ["b"], nested: { b: 2 } };
  const out = mergeSettings(a, b as never);
  assert.deepEqual(out.app, { name: "demo", port: 99 });
  assert.deepEqual(out.features, ["a", "b"]);
  assert.deepEqual(out.nested, { a: 1, b: 2 });
  assert.deepEqual(a.features, ["a"]);
});

Connect to ProvenPin

Add the free MCP server so your agent can pull this recipe and others like it. Same setup as the docs.

terminal
claude mcp add --transport http provenpin https://mcp.provenpin.com/mcp

Any other MCP client: Streamable HTTP at https://mcp.provenpin.com/mcp. No API key, no signup.