I have the following class structure
module ChartingServices {
export class ChartOptions {
options: myOptions;
title: string;
}
export interface myOptions {
colors: string[];
legend: myLegend;
type: string;
}
export interface myLegend{
enabled: boolean;
labelFormatter: string;
}
}
and I instantiate it in the usual way: -
var chartOptions = new ChartingServices.ChartOptions();
I can set the chartOptions.title property without any problems.
However, I cannot get to the chartOptions.myOptions.type property and get the error "Unable to read property" type "undefined.
Given that I have many classes, I need to create an instance of each of them to set / read properties. What can I do to make the code work?
source
share