I have my interface like this
export interface Details {
Name: [{
First: string;
Last: string;
}];
}
I have an observable configuration variable
Configuration: KnockoutObservable<Details> = ko.observable<Details>();
and I would like to assign it a value in the constructor as follows:
config = {
Name: [{
First: "ABC",
Last: "DEF"
},
{
First: "LMN",
Last: "XYZ"
}]
};
this.Configuration(config);
and I get an error:
The types of the Name property are incompatible and the property 0 is not present in the type.
Enter '{First: string; Last: line; } [] 'is not assigned to the type' [{First: string; Last: line; }] '
I have no control over changing the interface, as it is used elsewhere. What is the correct way to initialize this configuration variable?
Thanks in advance.
source
share