I am writing a simple app in ionic 2 but I have a problem with the anc (Angular compiler) because when I run ionic serve it gives me the warning but the app runs on the browser normally, but when I try to build for my phone it breaks and the build process results an error.
var tempResults: ResultModel = new ResultModel(currentOne.id, (me.res.length > 1) ? me.res[0] : me.res[0], (me.res.length > 1) ? me.res[1] : me.res[0], currentOne.question, currentOne.imagePath);
console.log(localforage.hasOwnProperty('result'))
localforage.getItem('results').then(data=> {
var allResponses: Array<ResultModel> = new Array<ResultModel>();
if (data != null) {
var allResponses: Array<ResultModel> = <Array<ResultModel>>JSON.parse(data);
allResponses.push(tempResults);
localforage.setItem('results', JSON.stringify(allResponses));
} else {
allResponses.push(tempResults);
localforage.setItem('results', JSON.stringify(allResponses));
}
});
The Line that triggers the error is : var allResponses: Array = >JSON.parse(data);
And the error is :
ngc error: Error: Error at C:/Users/.../result-item.ts:23:52: Argument of type '{}' is not assignable to parameter of type 'string'.
And I am getting a type error in the compiler and I am starting to think that this might be a bug after all.
.then((data: string) => {maybe might work