TypeScript / Nested leaf merge

TypeScript Class Object Leaf Merge

This page has a stable URL for review, documentation, and implementation comparison. The fixture tabs show merge inputs and output; the contract tabs show JSON and compact ruleset renderings with stable IDs and deterministic ownership.

Advanced .ts advanced leaf mergenested leavesdestination leaf winstypescriptclass_object_literal_leavesstructural_signaturenative_read_portable_writenormalize_tracked_layout_merge

Fixture sources

JSON fixture: structuredmerge-fixtures/typescript/slice-720-advanced-leaf-merge/class-object-leaf-merge.json

Compact ruleset: structuredmerge-fixtures/rulesets/typescript/slice-720-advanced-leaf-merge/class-object-leaf-merge.smrules

Fixture view
export class PatientSummary {
  profile = {
    demographics: {
      name: { given: 'Pat', family: 'Template' },
      contact: { email: '[email protected]', phone: '555-0100' }
    },
    carePlan: {
      status: 'draft',
      goals: { mobility: 'walk daily', nutrition: 'low sodium' }
    }
  };
}
Contract view
{
  "contract_id": "typescript-class-object-leaf-merge",
  "format": "typescript",
  "owners": "class_object_literal_leaves",
  "match": "structural_signature",
  "read": "native_read_portable_write",
  "attach": "normalize_tracked_layout_merge",
  "comment_style": "c_style_line",
  "render": "typescript_declarations",
  "surfaces": [
    {
      "name": "object_literal_property",
      "selector": "stable_path"
    }
  ],
  "capabilities": {
    "nested_leaf_merge": true,
    "destination_leaf_wins": true,
    "template_missing_leaf_adds": true
  }
}