Test if a key-value pair exists in nested object in Typescript
Based on your description of the function, I would expect this test to return true, but your implementation returns false.  So, either your description is unclear, or your implementation is buggy.
const obj ={
   &quot;a&quot;:{
      &quot;b&quot;:{
         &quot;a3&quot;:&quot;v2&quot;,
         &quot;c1&quot;:[&quot;1&quot;,&quot;2&quot;],
         &quot;c2&quot;:&quot;3&quot;
      },
      &quot;b2&quot;:&quot;values&quot;,
      &quot;b3&quot;: {&quot;c5&quot;: &quot;v&quot;},
   },
   &quot;a2&quot;:[&quot;v1&quot;,&quot;v2&quot;],
   &quot;a3&quot;:&quot;v1&quot;
}
checkNestedObjectByKeyValue(obj, &quot;a3&quot;, &quot;v2&quot;) // false, but I would expect true