views:

161

answers:

1

So basically if the page structure looks like the following below

var someControlInstance;

function onInit() {
   someControlInstance = new ControlLibrary.SampleControl(targetElement);
}

function someOtherFunctionInvokedAfterInit()
{
   someControlInstance.Property? //<-- No intellisense<br>
}

in the onInit() function, i can see the events, properties ect of the control, however when you are in another function, the Visual Studio IDE now has no idea what 'Type' the someControlInstance is. Is there some special trick or 'Cast' function available to get intellisense to come up?

A: 

Actually, no.

Because JavaScript is a dynamically typed language, there is no way to know what type an object will be design time.

They know the type when you are in OnInit, because you just set the type. In the other function, many things could have happened before the function was called, so there is no way to know.

Gabriel McAdams

related questions