a simple function in typescript:
callAPI ():JSONObject{
let j:JSONObject;
$.ajax().done((data, textStatus, jqXHR)=>{
//some operation around data
j = data;
return j;
});
}
The error is very straight forward,
A function whose declared type is neither 'void' nor 'any' must return a value.
I just don't know how to fix since i can't return that object when the ajax is not finish. Who knows how to deal with this situation?