How to combine two objects of different types in TypeScript?

Initially, I define

a = {};

After some processing i get

a = {p:"1", f:"2"}

b = {"3","5"}

I tried to merge these two results. I tried

cart = [];


and get the result as below:

{p: "1", f: "2"}

{b: ["3","5"]}

I want the result like:

a ={p:"1", f:"2", b:"3","5"}

How can I achieve the above.

Read more here:

Content Attribution

This content was originally published by An student at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: