Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jsx): rename Hono to JSX and export JSX namespace #2937

Merged
merged 2 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/jsx/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { escapeToBuffer, stringBufferToString } from '../utils/html'
import type { HtmlEscaped, HtmlEscapedString, StringBuffer } from '../utils/html'
import type { Context } from './context'
import { globalContexts } from './context'
import type { Hono, IntrinsicElements as IntrinsicElementsDefined } from './intrinsic-elements'
import type {
JSX as HonoJSX,
IntrinsicElements as IntrinsicElementsDefined,
} from './intrinsic-elements'
import { normalizeIntrinsicElementProps, styleObjectForEach } from './utils'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand All @@ -13,7 +16,7 @@ export type FC<P = Props> = {
defaultProps?: Partial<P> | undefined
displayName?: string | undefined
}
export type DOMAttributes = Hono.HTMLAttributes
export type DOMAttributes = HonoJSX.HTMLAttributes

// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace JSX {
Expand Down
2 changes: 2 additions & 0 deletions src/jsx/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,5 @@ export default {
}

export type * from './types'

export type { JSX } from './intrinsic-elements'
4 changes: 2 additions & 2 deletions src/jsx/intrinsic-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace Hono {
export namespace JSX {
export type CrossOrigin = 'anonymous' | 'use-credentials' | '' | undefined
export type CSSProperties = {}
type AnyAttributes = { [attributeName: string]: any }
Expand Down Expand Up @@ -726,4 +726,4 @@ export namespace Hono {
}
}

export interface IntrinsicElements extends Hono.IntrinsicElements {}
export interface IntrinsicElements extends JSX.IntrinsicElements {}
4 changes: 2 additions & 2 deletions src/jsx/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
* All types exported from "hono/jsx" are in this file.
*/
import type { Child, JSXNode } from './base'
import type { Hono } from './intrinsic-elements'
import type { JSX } from './intrinsic-elements'

export type { Child, JSXNode, FC } from './base'
export type { RefObject } from './hooks'
export type { Context } from './context'

export type PropsWithChildren<P = unknown> = P & { children?: Child | undefined }
export type CSSProperties = Hono.CSSProperties
export type CSSProperties = JSX.CSSProperties

/**
* React types
Expand Down