hono
hono copied to clipboard
Remove "children" from FC
What is the feature you are proposing?
(Due to my lack of insight) FC no longer includes children since React 18, so I would like to exclude children from hono accordingly.
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L853
diff --git a/src/jsx/index.ts b/src/jsx/index.ts
index 60b1eb1a..a1c052e7 100644
--- a/src/jsx/index.ts
+++ b/src/jsx/index.ts
@@ -273,9 +273,7 @@ export const jsxFn = (
}
}
-export type FC<T = Props> = (
- props: T & { children?: Child }
-) => HtmlEscapedString | Promise<HtmlEscapedString>
+export type FC<T = Props> = (props: T) => HtmlEscapedString | Promise<HtmlEscapedString>
const shallowEqual = (a: Props, b: Props): boolean => {
if (a === b) {
Hi @usualoma
It's good and how about providing PropsWithChildren like the @types/react?
type PropsWithChildren<P = unknown> = P & { children?: Child | undefined }
type Post = {
id: number
title: string
}
function Parent({ title, children }: PropsWithChildren<Post>) {
return (
<div>
<h1>{title}</h1>
{children}
</div>
)
}
This was fixed by #2151. Thanks!