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 { export interface AST {
tag: string; tag: string;
children: (AST | string)[] | (React.ReactElement | string)[]; children: (AST | string)[] | (JSX.Element | string)[];
props: {}; props: {};
Tag: React.ComponentType; Tag: React.ComponentType;
} }
+2 -3
View File
@@ -3,7 +3,6 @@ import React, {
useState, useState,
useEffect, useEffect,
useMemo, useMemo,
ReactElement,
ComponentType, ComponentType,
} from 'react'; } from 'react';
import Rect from './elements/Rect'; import Rect from './elements/Rect';
@@ -60,7 +59,7 @@ function missingTag() {
export interface AST { export interface AST {
tag: string; tag: string;
children: (AST | string)[] | (ReactElement | string)[]; children: (AST | string)[] | (JSX.Element | string)[];
props: {}; props: {};
Tag: ComponentType; Tag: ComponentType;
} }
@@ -195,7 +194,7 @@ export function getStyle(string: string): Styles {
export function astToReact( export function astToReact(
value: AST | string, value: AST | string,
index: number, index: number,
): ReactElement | string { ): JSX.Element | string {
if (typeof value === 'object') { if (typeof value === 'object') {
const { Tag, props, children } = value; const { Tag, props, children } = value;
return ( return (