xerotolerant xerotolerant - 4 months ago 44
TypeScript Question

Nativescript Typescript error property does not exist

Hello I am trying to get an Image element in a typescript xml page and set it's imageSource property programatically.

In the examples i've found it is done this way:

image = page.getViewById("id");
image.imageSource = newImageSource;

The issue that I am having when using typescript is

error 'imageSource' does not exist on type 'View'

I don't know how to work around that problem. any ideas?


Do image = <Image> page.getViewById('whatever'); Should resolve the type issue. Make sure to import the image module so you have the correct class.