I have the following interface set up:
export interface Details {
Name: [{
First: string;
Last: string;
}];
}
Within my code, I am using an observable configuration variable:
Configuration: KnockoutObservable<Details> = ko.observable<Details>();
In the constructor, I am trying to assign a value to it in this way:
config = {
Name: [{
First: "ABC",
Last: "DEF"
},
{
First: "LMN",
Last: "XYZ"
}]
};
this.Configuration(config);
However, I am encountering an error:
Types of property 'Name' is incompatible and property '0' is missing in type.
Type '{ First:string; Last:string; }[]' is not assignable to
type '[{ First: string; Last:string; }]'
Unfortunately, I cannot modify the interface as it is used elsewhere. What is the correct approach to initializing this configuration variable?
Thank you in advance.