refactor: refine types

This commit is contained in:
Mikael Sand
2019-09-09 22:38:28 +03:00
parent 9cda082d53
commit c3501cdcd0
2 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -426,7 +426,7 @@ export const Mask: React.ComponentClass<MaskProps>;
export interface AST {
tag: string;
children: (AST | string)[] | (React.ReactElement | string)[];
children: (AST | string)[] | (JSX.Element | string)[];
props: {};
Tag: React.ComponentType;
}
+2 -3
View File
@@ -3,7 +3,6 @@ import React, {
useState,
useEffect,
useMemo,
ReactElement,
ComponentType,
} from 'react';
import Rect from './elements/Rect';
@@ -60,7 +59,7 @@ function missingTag() {
export interface AST {
tag: string;
children: (AST | string)[] | (ReactElement | string)[];
children: (AST | string)[] | (JSX.Element | string)[];
props: {};
Tag: ComponentType;
}
@@ -195,7 +194,7 @@ export function getStyle(string: string): Styles {
export function astToReact(
value: AST | string,
index: number,
): ReactElement | string {
): JSX.Element | string {
if (typeof value === 'object') {
const { Tag, props, children } = value;
return (