I have an app in ionic 2 RC0 version. After I updated my ionic to ionic 2 RC1 (checked with the blog post) I am getting the following error:
Property ‘items’ does not exist on type '{}'
I have a provider which fetches data from a server. The data returned is an object containing items, but I can no longer access it.
How is your load method in the fetchService implemented?
If you return a promise, you should “type” it with any:
return new Promise < any > (resolve => {
…
})
or you can use:
data[‘items’] instead of data.items
I think if the fetchService.load() method has a defined return type of any … or of another object that has the items property, you will not get this error.
@ihadeed
Thanks again.
So the correct way is to add data:any like the following:
this.fetchService.load().then((data: any) => {
console.log(data.items);
});