summaryrefslogtreecommitdiff
path: root/src/frontend/render/react.ts
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@matthewphillips.info> 2021-04-09 13:03:27 -0400
committerGravatar GitHub <noreply@github.com> 2021-04-09 13:03:27 -0400
commit185a26713322f1a134c432e65b55b4b3325eea9b (patch)
treeeb7e102e492a7b0d10afed8c55cd172739e1b651 /src/frontend/render/react.ts
parent4ccf4196e31333b41e37259488f6fa0a81c3518b (diff)
downloadastro-185a26713322f1a134c432e65b55b4b3325eea9b.tar.gz
astro-185a26713322f1a134c432e65b55b4b3325eea9b.tar.zst
astro-185a26713322f1a134c432e65b55b4b3325eea9b.zip
Improve renderer types (#69)
* Improve renderer types Looking at the render code I noticed that the Component rendering is not typed. This adds that, might help prevent a bug in the future. * Create the supported renderer type
Diffstat (limited to 'src/frontend/render/react.ts')
-rw-r--r--src/frontend/render/react.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/frontend/render/react.ts b/src/frontend/render/react.ts
index b9e55f1c9..56c6decb0 100644
--- a/src/frontend/render/react.ts
+++ b/src/frontend/render/react.ts
@@ -1,9 +1,9 @@
import type { ComponentRenderer } from '../../@types/renderer';
-import React from 'react';
+import React, { ComponentType } from 'react';
import ReactDOMServer from 'react-dom/server';
import { createRenderer } from './renderer';
-const ReactRenderer: ComponentRenderer = {
+const ReactRenderer: ComponentRenderer<ComponentType> = {
renderStatic(Component) {
return async (props, ...children) => ReactDOMServer.renderToString(React.createElement(Component, props, children));
},