0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-24 11:07:29 +01:00

fix(jsx): fix a jsx-runtime bug (#1070)

* fix(jsx): fix a `jsx-runtime`

* fixed for Bun

* denoify
This commit is contained in:
Yusuke Wada 2023-05-05 10:46:49 +09:00 committed by GitHub
parent 21f4c196e7
commit c50dcf03bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -4,7 +4,7 @@ import type { JSXNode } from './index.ts'
export { Fragment } from './index.ts'
export function jsxDEV(tag: string | Function, props: Record<string, unknown>): JSXNode {
const children = (props.children ?? []) as (string | HtmlEscapedString)
const children = (props.children ?? []) as string | HtmlEscapedString
delete props['children']
return jsx(tag, props, children)
return Array.isArray(children) ? jsx(tag, props, ...children) : jsx(tag, props, children)
}

View File

@ -4,7 +4,7 @@ import type { JSXNode } from '.'
export { Fragment } from '.'
export function jsxDEV(tag: string | Function, props: Record<string, unknown>): JSXNode {
const children = (props.children ?? []) as (string | HtmlEscapedString)
const children = (props.children ?? []) as string | HtmlEscapedString
delete props['children']
return jsx(tag, props, children)
return Array.isArray(children) ? jsx(tag, props, ...children) : jsx(tag, props, children)
}

View File

@ -24,6 +24,7 @@
"include": [
"src/**/*.ts",
"src/**/*.mts",
"src/**/*.test.ts"
"src/**/*.test.ts",
"src/**/*.test.tsx"
],
}