Skip to content

Commit

Permalink
chore: fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
chizukicn committed Oct 24, 2023
1 parent a3615a3 commit 019bc84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function resolveElement(ele: any) {
export async function createElement(
tag: string,
props: any = {},
...children: (string | JSX.Element)[]
...children: any[]
) {
if (!props || !isObject(props) || Array.isArray(props)) {
props = {};
Expand All @@ -28,7 +28,7 @@ export async function createElement(
}

async function renderChildren(
children: (string | JSX.Element)[]
children: any[]
): Promise<string> {
if (Array.isArray(children)) {
const tasks = children.map(async (c) =>
Expand All @@ -51,7 +51,7 @@ export const FourzeComponentFlag = "__isFourzeComponent";
export interface FourzeComponentOption {
name?: string
setup?: () => MaybePromise<this["render"] | Record<string, any>>
render?: () => MaybePromise<JSX.Element>
render?: () => MaybePromise<any>
}

export interface FourzeComponent extends FourzeComponentOption {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface RenderHtmlOptions {

const notCloseTags = ["img", "br", "hr", "input", "meta", "link", "area"];

export function renderElement(tag: string, props: any = {}, ...children: (string | JSX.Element)[]) {
export function renderElement(tag: string, props: any = {}, ...children: any[]) {
if (!props || !isObject(props) || Array.isArray(props)) {
props = {};
}
Expand All @@ -63,7 +63,7 @@ export function renderElement(tag: string, props: any = {}, ...children: (string
props.class = props.class.join(" ");
}

function renderChildren(children: (string | JSX.Element)[]): string {
function renderChildren(children: any[]): string {
if (Array.isArray(children)) {
return children.map((c) => (Array.isArray(c) ? renderChildren(c) : c)).join("");
}
Expand Down

0 comments on commit 019bc84

Please sign in to comment.