From 4c36a09fcebc0fcfe1b1b8d15a78f13e7f8b90e1 Mon Sep 17 00:00:00 2001 From: chenshuai2144 Date: Mon, 11 Nov 2019 23:26:37 +0800 Subject: [PATCH] fix: fix typescript type error fix #5578 --- src/pages/user/login/components/Login/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/user/login/components/Login/index.tsx b/src/pages/user/login/components/Login/index.tsx index 00c32a18..b6676c04 100644 --- a/src/pages/user/login/components/Login/index.tsx +++ b/src/pages/user/login/components/Login/index.tsx @@ -18,7 +18,7 @@ export interface LoginProps { className?: string; form: FormComponentProps['form']; onCreate?: (form?: FormComponentProps['form']) => void; - children: React.ReactElement[]; + children: React.ReactElement[]; } interface LoginState { @@ -125,16 +125,16 @@ class Login extends Component { render() { const { className, children } = this.props; const { type, tabs = [] } = this.state; - const TabChildren: React.ReactComponentElement[] = []; + const TabChildren: React.ReactComponentElement[] = []; const otherChildren: React.ReactElement[] = []; React.Children.forEach( children, - (child: React.ReactComponentElement | React.ReactElement) => { + (child: React.ReactComponentElement | React.ReactElement) => { if (!child) { return; } - if (child.type.typeName === 'LoginTab') { - TabChildren.push(child as React.ReactComponentElement); + if ((child.type as { typeName: string }).typeName === 'LoginTab') { + TabChildren.push(child as React.ReactComponentElement); } else { otherChildren.push(child); }