(I'm struggling to phrase the question accurately, and I haven't been able to find a solution elsewhere)
Take a look at the example below:
export interface MasterProps {
objects?: Array<{chart: ChartOpts} | {image: ImageOpts}>
}
I am not allowed to modify the above definitions.
Now, I understand that I can determine the type of the objects
property by using this code:
let obj: MasterProps['objects']
This will define obj as
Array<{chart: IChartOpts} | {image: ImageProps}>
But how can I specifically assign obj the type
{chart: IChartOpts} | {image: ImageProps}
?