Skip to content

Commit 18dd2a4

Browse files
author
Ben Grynhaus
committed
Removed some redundant casting
1 parent 89d39b9 commit 18dd2a4

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

libs/core/src/renderer/react-node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export class ReactNode {
175175
}
176176
// It is expected that the element will be recreated and re-rendered with each attribute change.
177177
// See: https://reactjs.org/docs/rendering-elements.html
178-
ReactDOM.render(this.renderRecursive() as any, this._parent);
178+
ReactDOM.render(this.renderRecursive() as React.ReactElement<{}>, this._parent);
179179
this.isRenderPending = false;
180180
}
181181
}

libs/core/src/renderer/renderer.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// tslint:disable:no-bitwise
2-
31
import { Injectable, Renderer2, RendererStyleFlags2, RendererType2 } from '@angular/core';
42
import { EventManager, ɵDomRendererFactory2, ɵDomSharedStylesHost } from '@angular/platform-browser';
53
import * as ReactDOM from 'react-dom';
@@ -78,7 +76,7 @@ export class AngularReactRendererFactory extends ɵDomRendererFactory2 {
7876
}
7977

8078
class ReactRenderer implements Renderer2 {
81-
readonly data: { [key: string]: any } = Object.create(null);
79+
readonly data: StringMap<any> = Object.create(null);
8280

8381
constructor(private rootRenderer: AngularReactRendererFactory) {}
8482

libs/core/src/renderer/renderprop-helpers.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
import { ComponentRef, TemplateRef } from "@angular/core";
1+
import { ComponentRef, TemplateRef } from '@angular/core';
22
import * 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

66
function 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

Comments
 (0)