From f7b60c9a0966778255ad85f9b050864474366f4d Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Mon, 5 Jun 2023 14:09:06 +0800 Subject: [PATCH] doc: update docs/typescript.md --- docs/typescript.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/typescript.md b/docs/typescript.md index 75fc030b..a199912c 100644 --- a/docs/typescript.md +++ b/docs/typescript.md @@ -1185,17 +1185,17 @@ function Dog(prop:CeProps): JSX.Element { ```tsx -interface MenuProps extends React.LiHTMLAttributes { ... } -const InternalMenu = (props: MenuProps, ref?: React.ForwardedRef) => ( +interface MenuProps extends React.LiHTMLAttributes { ... }; +const InternalMenu = React.forwardRef((props, ref) => (
    -); -type MenuComponent = React.FC> & { +)); + +type MenuComponent = typeof InternalMenu & { Item: typeof MenuItem; // MenuItem 函数组件 SubMenu: typeof SubMenu; // SubMenu 函数组件 }; -const Menu: MenuComponent = React.forwardRef( - InternalMenu -) as unknown as MenuComponent; + +const Menu: MenuComponent = InternalMenu as unknown as MenuComponent; Menu.Item = MenuItem; Menu.SubMenu = SubMenu;