I am using typescript language in angularjs 2 to my REST api application, the problem is - typescript gives compile time error of
[ts] Property 'name' does not exist on type 'JSON'.any
WHEN I TRY TO ACCESS INCOMING JSON Object, my function code is below
createPerformanceChart(data: JSON) {
// Show Up the Fund Details Data
var details: any;
for(var j = 0 ; j < Object.keys(this.funds).length; j++)
{
if(data.name == this.funds[j].name) // data.name throws Error
{
details = this.funds[j];
}
}
}
How can I convert the JSON or access JSON Object - such that it does not throw compile time error and let me compile the code.
dataobject is not of typeJSON? Use proper types orany.