I want to concatenate 2 arrays of nested objects of different types with lodash concat method. However typescript linter rise error about 2nd array type. My first array is:
[
{
Header: '...',
accessor: '...',
minWidth: 200,
Filter: {...},
filter: {...},
Aggregated: () => null,
},
{
Header: '...',
accessor: '...',
minWidth: 200,
Filter: {...},
filter: {...},
Aggregated: () => null,
},
{
Header: '...',
accessor: '...',
minWidth: 200,
Aggregated: () => null,
},
{
Header: '...',
accessor: '...',
minWidth: 200,
},
...
]
Where Filter and filter are big nested objects. My second array is:
[
{
Header: '...',
accessor: '...',
disableGroupBy: true,
}
]
I am getting typescript linter error
Type '{ Header: string; accessor: string; disableGroupBy: boolean; }' is missing the following properties from type {...} : minWidth, Filter, filter.
Note that there is no Aggregated property requirement.
Lodash documentation says about concat:
Creates a new array concatenating array with any additional arrays and/or values.
- Does it mean I can only concat flat objects or primitive values?
- Can I concat only arrays of nested objects of the same types?
- Should I use different method?