@@ -17,6 +17,7 @@ import {
1717 HostViewFactoryRef_ ,
1818 EmbeddedViewRef ,
1919 HostViewRef ,
20+ ViewRef ,
2021 ViewRef_
2122} from './view_ref' ;
2223import { ViewContainerRef } from './view_container_ref' ;
@@ -189,20 +190,20 @@ export class AppViewManager_ extends AppViewManager {
189190 super ( ) ;
190191 }
191192
192- getViewContainer ( location : ElementRef_ ) : ViewContainerRef {
193- return location . internalElement . getViewContainerRef ( ) ;
193+ getViewContainer ( location : ElementRef ) : ViewContainerRef {
194+ return ( < ElementRef_ > location ) . internalElement . getViewContainerRef ( ) ;
194195 }
195196
196- getHostElement ( hostViewRef : ViewRef_ ) : ElementRef {
197- var hostView = hostViewRef . internalView ;
197+ getHostElement ( hostViewRef : ViewRef ) : ElementRef {
198+ var hostView = ( < ViewRef_ > hostViewRef ) . internalView ;
198199 if ( hostView . proto . type !== ViewType . HOST ) {
199200 throw new BaseException ( 'This operation is only allowed on host views' ) ;
200201 }
201202 return hostView . appElements [ 0 ] . ref ;
202203 }
203204
204- getNamedElementInComponentView ( hostLocation : ElementRef_ , variableName : string ) : ElementRef {
205- var appEl = hostLocation . internalElement ;
205+ getNamedElementInComponentView ( hostLocation : ElementRef , variableName : string ) : ElementRef {
206+ var appEl = ( < ElementRef_ > hostLocation ) . internalElement ;
206207 var componentView = appEl . componentView ;
207208 if ( isBlank ( componentView ) ) {
208209 throw new BaseException ( `There is no component directive at element ${ hostLocation } ` ) ;
@@ -216,17 +217,17 @@ export class AppViewManager_ extends AppViewManager {
216217 throw new BaseException ( `Could not find variable ${ variableName } ` ) ;
217218 }
218219
219- getComponent ( hostLocation : ElementRef_ ) : any {
220- return hostLocation . internalElement . getComponent ( ) ;
220+ getComponent ( hostLocation : ElementRef ) : any {
221+ return ( < ElementRef_ > hostLocation ) . internalElement . getComponent ( ) ;
221222 }
222223
223224 /** @internal */
224225 _createRootHostViewScope : WtfScopeFn = wtfCreateScope ( 'AppViewManager#createRootHostView()' ) ;
225226
226- createRootHostView ( hostViewFactoryRef : HostViewFactoryRef_ , overrideSelector : string ,
227+ createRootHostView ( hostViewFactoryRef : HostViewFactoryRef , overrideSelector : string ,
227228 injector : Injector , projectableNodes : any [ ] [ ] = null ) : HostViewRef {
228229 var s = this . _createRootHostViewScope ( ) ;
229- var hostViewFactory = hostViewFactoryRef . internalHostViewFactory ;
230+ var hostViewFactory = ( < HostViewFactoryRef_ > hostViewFactoryRef ) . internalHostViewFactory ;
230231 var selector = isPresent ( overrideSelector ) ? overrideSelector : hostViewFactory . selector ;
231232 var view = hostViewFactory . viewFactory ( this . _renderer , this , null , projectableNodes , selector ,
232233 null , injector ) ;
@@ -236,9 +237,9 @@ export class AppViewManager_ extends AppViewManager {
236237 /** @internal */
237238 _destroyRootHostViewScope : WtfScopeFn = wtfCreateScope ( 'AppViewManager#destroyRootHostView()' ) ;
238239
239- destroyRootHostView ( hostViewRef : ViewRef_ ) {
240+ destroyRootHostView ( hostViewRef : ViewRef ) {
240241 var s = this . _destroyRootHostViewScope ( ) ;
241- var hostView = hostViewRef . internalView ;
242+ var hostView = ( < ViewRef_ > hostViewRef ) . internalView ;
242243 hostView . renderer . detachView ( flattenNestedViewRenderNodes ( hostView . rootNodesOrAppElements ) ) ;
243244 hostView . destroy ( ) ;
244245 wtfLeave ( s ) ;
@@ -248,42 +249,44 @@ export class AppViewManager_ extends AppViewManager {
248249 _createEmbeddedViewInContainerScope : WtfScopeFn =
249250 wtfCreateScope ( 'AppViewManager#createEmbeddedViewInContainer()' ) ;
250251
251- createEmbeddedViewInContainer ( viewContainerLocation : ElementRef_ , index : number ,
252- templateRef : TemplateRef_ ) : EmbeddedViewRef {
252+ createEmbeddedViewInContainer ( viewContainerLocation : ElementRef , index : number ,
253+ templateRef : TemplateRef ) : EmbeddedViewRef {
253254 var s = this . _createEmbeddedViewInContainerScope ( ) ;
254- var contextEl = templateRef . elementRef . internalElement ;
255+ var contextEl = ( < TemplateRef_ > templateRef ) . elementRef . internalElement ;
255256 var view : AppView =
256257 contextEl . embeddedViewFactory ( contextEl . parentView . renderer , this , contextEl ,
257258 contextEl . parentView . projectableNodes , null , null , null ) ;
258- this . _attachViewToContainer ( view , viewContainerLocation . internalElement , index ) ;
259+ this . _attachViewToContainer ( view , ( < ElementRef_ > viewContainerLocation ) . internalElement , index ) ;
259260 return wtfLeave ( s , view . ref ) ;
260261 }
261262
262263 /** @internal */
263264 _createHostViewInContainerScope : WtfScopeFn =
264265 wtfCreateScope ( 'AppViewManager#createHostViewInContainer()' ) ;
265266
266- createHostViewInContainer ( viewContainerLocation : ElementRef_ , index : number ,
267- hostViewFactoryRef : HostViewFactoryRef_ ,
267+ createHostViewInContainer ( viewContainerLocation : ElementRef , index : number ,
268+ hostViewFactoryRef : HostViewFactoryRef ,
268269 dynamicallyCreatedProviders : ResolvedProvider [ ] ,
269270 projectableNodes : any [ ] [ ] ) : HostViewRef {
270271 var s = this . _createHostViewInContainerScope ( ) ;
271272 // TODO(tbosch): This should be specifiable via an additional argument!
272- var contextEl = viewContainerLocation . internalElement ;
273- var hostViewFactory = hostViewFactoryRef . internalHostViewFactory ;
273+ var viewContainerLocation_ = < ElementRef_ > viewContainerLocation ;
274+ var contextEl = viewContainerLocation_ . internalElement ;
275+ var hostViewFactory = ( < HostViewFactoryRef_ > hostViewFactoryRef ) . internalHostViewFactory ;
274276 var view = hostViewFactory . viewFactory (
275277 contextEl . parentView . renderer , contextEl . parentView . viewManager , contextEl ,
276278 projectableNodes , null , dynamicallyCreatedProviders , null ) ;
277- this . _attachViewToContainer ( view , viewContainerLocation . internalElement , index ) ;
279+ this . _attachViewToContainer ( view , viewContainerLocation_ . internalElement , index ) ;
278280 return wtfLeave ( s , view . ref ) ;
279281 }
280282
281283 /** @internal */
282284 _destroyViewInContainerScope = wtfCreateScope ( 'AppViewMananger#destroyViewInContainer()' ) ;
283285
284- destroyViewInContainer ( viewContainerLocation : ElementRef_ , index : number ) {
286+ destroyViewInContainer ( viewContainerLocation : ElementRef , index : number ) {
285287 var s = this . _destroyViewInContainerScope ( ) ;
286- var view = this . _detachViewInContainer ( viewContainerLocation . internalElement , index ) ;
288+ var view =
289+ this . _detachViewInContainer ( ( < ElementRef_ > viewContainerLocation ) . internalElement , index ) ;
287290 view . destroy ( ) ;
288291 wtfLeave ( s ) ;
289292 }
@@ -292,20 +295,23 @@ export class AppViewManager_ extends AppViewManager {
292295 _attachViewInContainerScope = wtfCreateScope ( 'AppViewMananger#attachViewInContainer()' ) ;
293296
294297 // TODO(i): refactor detachViewInContainer+attachViewInContainer to moveViewInContainer
295- attachViewInContainer ( viewContainerLocation : ElementRef_ , index : number ,
296- viewRef : ViewRef_ ) : EmbeddedViewRef {
298+ attachViewInContainer ( viewContainerLocation : ElementRef , index : number ,
299+ viewRef : ViewRef ) : EmbeddedViewRef {
300+ var viewRef_ = < ViewRef_ > viewRef ;
297301 var s = this . _attachViewInContainerScope ( ) ;
298- this . _attachViewToContainer ( viewRef . internalView , viewContainerLocation . internalElement , index ) ;
299- return wtfLeave ( s , viewRef ) ;
302+ this . _attachViewToContainer ( viewRef_ . internalView ,
303+ ( < ElementRef_ > viewContainerLocation ) . internalElement , index ) ;
304+ return wtfLeave ( s , viewRef_ ) ;
300305 }
301306
302307 /** @internal */
303308 _detachViewInContainerScope = wtfCreateScope ( 'AppViewMananger#detachViewInContainer()' ) ;
304309
305310 // TODO(i): refactor detachViewInContainer+attachViewInContainer to moveViewInContainer
306- detachViewInContainer ( viewContainerLocation : ElementRef_ , index : number ) : EmbeddedViewRef {
311+ detachViewInContainer ( viewContainerLocation : ElementRef , index : number ) : EmbeddedViewRef {
307312 var s = this . _detachViewInContainerScope ( ) ;
308- var view = this . _detachViewInContainer ( viewContainerLocation . internalElement , index ) ;
313+ var view =
314+ this . _detachViewInContainer ( ( < ElementRef_ > viewContainerLocation ) . internalElement , index ) ;
309315 return wtfLeave ( s , view . ref ) ;
310316 }
311317
0 commit comments