Property 'isEnabled' does not exist on type 'ViewBase' after moving to NS 3.0


Hi all,

I just moved to Nativescript 3.0 and I am using nativescript-dom plugin to disable the buttons. It was all working fine with NS 2.5 but after moving and updating NS and all the plugins (v3.0 compatible ) I get this error :

Property ‘isEnabled’ does not exist on type ‘ViewBase’

Maybe somebody has similar issues or have any ideas how to solve it. Thanks in advance


Can you paste your code and the complete error message output? This sounds like a TS warning and can easily be fixed bu t need to see more of your code to help resolve :smile:


@bradwaynemartin thank you for your prompt reply.

Here is the code:

function screenEnabled(isEnabled) {     
  runAgainstTagNames('TextField', function(e) { e.isEnabled = isEnabled; });
  runAgainstTagNames('Button', function(e) { e.isEnabled = isEnabled; }); 
  runAgainstTagNames('CheckBox', function(e) { e.isEnabled = isEnabled; }); 
	runAgainstTagNames('Label', function(e) { e.isEnabled = isEnabled; }); 

And here is the warning which I get in the console:

app/pages/mainTabs/mainTabs.component.ts(48,51): error TS2339: Property 'isEnabled' does not exist on type 'ViewBase'.



Okay so what’s happening is the type for e in the function(e) args is of ViewBase which does not have the isEnabled property. The NS View class has the isEnabled property. So all you have is a TS warning, you can still run with this type of warning but best to clear it up :smile:

You can do this a few ways but the quickest option is to assign a type to the argument (in this case the e). You can do this with function(e: View) but also to reference the View class you would need to import it into this file/module so TS knows about it when you use it. Then when you are accessing the isEnabled property TS knows that e is of type View and it is aware of that property and the error will disappear.

Hope that makes sense and helps you learn a little bit :thumbsup:


Thank you for prompt reply and detailed explanation. Warning is gone. Thank you very much.