I declare a object template which I populate with data:
let dataTemplate = {
publishedDate: "",
Url: "",
Title: "",
}
dataTemplate.publishedDate = xml.children[4].children[i].children[13].value;
dataTemplate.Url = xml.children[4].children[i].children[16].value;
dataTemplate.Title = xml.children[4].children[i].children[58].value;
I then declare a string array and try to push the above object to the array:
let data: String[] = [];
data.push(dataTemplate);
But I get a syntax error at "dataTemplate" at the following line:
data.push(dataTemplate);
[ts]
Argument of type '{ publishedDate: string; Url: string; Title: string; }' is not assignable to parameter of type 'String'.
Property 'padStart' is missing in type '{ publishedDate: string; Url: string; Title: string; }'.
How come? I use TS 3.3 and cannot uppgrade (MS SPFx does not have support for newer versions.