type(Tag): add React.ReactNode (#43357)

This commit is contained in:
thinkasany 2023-07-05 13:07:13 +08:00 committed by GitHub
parent 87a4bc882e
commit 893b5285c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,9 +117,9 @@ const InternalTag: React.ForwardRefRenderFunction<HTMLSpanElement, TagProps> = (
typeof props.onClick === 'function' ||
(children && (children as React.ReactElement<any>).type === 'a');
const iconNode = icon || null;
const iconNode: React.ReactNode = icon || null;
const kids = iconNode ? (
const kids: React.ReactNode = iconNode ? (
<>
{iconNode}
<span>{children}</span>
@ -128,7 +128,7 @@ const InternalTag: React.ForwardRefRenderFunction<HTMLSpanElement, TagProps> = (
children
);
const tagNode = (
const tagNode: React.ReactNode = (
<span {...props} ref={ref} className={tagClassName} style={tagStyle}>
{kids}
{closeIconNode}