From 37e9c6b1116a99e2d11f7eae6ea75562c7865a14 Mon Sep 17 00:00:00 2001 From: zoomdong <1344492820@qq.com> Date: Fri, 5 Jun 2020 17:41:25 +0800 Subject: [PATCH] fix: paramter type error (#24429) * fix: paramter type error * feat: adjust * feat: add type.test.tsx --- components/tree/Tree.tsx | 2 +- components/tree/__tests__/type.test.tsx | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 components/tree/__tests__/type.test.tsx diff --git a/components/tree/Tree.tsx b/components/tree/Tree.tsx index 8d0af000cc..43b52fbd95 100644 --- a/components/tree/Tree.tsx +++ b/components/tree/Tree.tsx @@ -41,7 +41,7 @@ export interface AntTreeNodeProps { selected?: boolean; selectable?: boolean; icon?: ((treeNode: AntdTreeNodeAttribute) => React.ReactNode) | React.ReactNode; - children?: React.ReactNode; + children?: React.ReactElement[]; [customProp: string]: any; } diff --git a/components/tree/__tests__/type.test.tsx b/components/tree/__tests__/type.test.tsx new file mode 100644 index 0000000000..57f938b6a1 --- /dev/null +++ b/components/tree/__tests__/type.test.tsx @@ -0,0 +1,13 @@ +/* eslint-disable */ +import * as React from 'react'; +import { AntTreeNodeProps } from '../Tree'; + +describe('Tree TypeScript Test', async () => { + it('AntTreeNodeProps', () => { + const tree: AntTreeNodeProps = { + children: [React.createElement('h1')], + }; + + expect(tree).toBeTruthy(); + }); +});