1- import { ComponentRef , TemplateRef } from " @angular/core" ;
1+ import { ComponentRef , TemplateRef } from ' @angular/core' ;
22import * as React from 'react' ;
33
4- import { CHILDREN_TO_APPEND_PROP , ReactContent } from " ../renderer/react-content" ;
4+ import { CHILDREN_TO_APPEND_PROP , ReactContent } from ' ../renderer/react-content' ;
55
66function renderReactContent ( rootNodes : HTMLElement [ ] ) : JSX . Element {
7- return React . createElement (
8- ReactContent ,
9- {
10- [ CHILDREN_TO_APPEND_PROP ] : rootNodes
11- } as any
12- ) ;
7+ return React . createElement ( ReactContent , {
8+ [ CHILDREN_TO_APPEND_PROP ] : rootNodes ,
9+ } ) ;
1310}
1411
1512/**
@@ -18,7 +15,10 @@ function renderReactContent(rootNodes: HTMLElement[]): JSX.Element {
1815 * @param templateRef The template to wrap
1916 * @param context The context to pass to the template
2017 */
21- export function renderTemplate < TContext extends object > ( templateRef : TemplateRef < TContext > , context ?: TContext ) : JSX . Element {
18+ export function renderTemplate < TContext extends object > (
19+ templateRef : TemplateRef < TContext > ,
20+ context ?: TContext
21+ ) : JSX . Element {
2222 const viewRef = templateRef . createEmbeddedView ( context ) ;
2323 viewRef . detectChanges ( ) ;
2424
@@ -31,7 +31,10 @@ export function renderTemplate<TContext extends object>(templateRef: TemplateRef
3131 * @param htmlRenderFunc The function to wrap
3232 * @param context The context to pass to the function
3333 */
34- export function renderFunc < TContext extends object > ( htmlRenderFunc : ( context : TContext ) => HTMLElement , context ?: TContext ) : JSX . Element {
34+ export function renderFunc < TContext extends object > (
35+ htmlRenderFunc : ( context : TContext ) => HTMLElement ,
36+ context ?: TContext
37+ ) : JSX . Element {
3538 const rootHtmlElement = htmlRenderFunc ( context ) ;
3639
3740 return renderReactContent ( [ rootHtmlElement ] ) ;
@@ -43,7 +46,10 @@ export function renderFunc<TContext extends object>(htmlRenderFunc: (context: TC
4346 * @param htmlRenderFunc The component reference to wrap
4447 * @param context The context to pass to the component as `@Input`
4548 */
46- export function renderComponent < TContext extends object > ( componentRef : ComponentRef < TContext > , context ?: TContext ) : JSX . Element {
49+ export function renderComponent < TContext extends object > (
50+ componentRef : ComponentRef < TContext > ,
51+ context ?: TContext
52+ ) : JSX . Element {
4753 Object . assign ( componentRef . instance , context ) ;
4854 componentRef . changeDetectorRef . detectChanges ( ) ;
4955
0 commit comments