xerotolerant xerotolerant - 1 year ago 99
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download