Here is an example
The basic idea is - I have a type which can be plain object, or array of objects.
type SingleOrArray<T> = T | T[];
And I have structure like this:
const area: ItemArea = [
{ name: 'test1' },
{ name: 'test2' },
[
{ name: 'test3' },
{ name: 'test4' },
[
{ name: 'test5' },
{ name: 'test6' },
[
{ name: 'test7' },
]
]
]
];
How I can restrict each element of this nested array with:
type Item = { name: string };
thx