Is it possible to combine two predefined Record types in TypeScript?
Consider the two Records below:
var dictionary1 : Record<string, string []> ={
'fruits' : ['apple','banana', 'cherry'],
'vegetables' : ['cucumber','onion']
};
var dictionary2 : Record<string, string []> ={
'fruits' : ['apple','banana', 'orange', 'pear'],
'vegetables' : ['cucumber','corn'],
'beverages' : ['soda']
};
I want to merge these two Records to achieve the following combined result:
var mergedDictionary : Record<string, string []> ={
'fruits' : ['apple','banana', 'cherry', 'orange', 'pear'],
'vegetables' : ['cucumber','onion', 'corn'],
'beverages' : ['soda']
};