From ee6f63f2e1ef0e63e67dad8190e81c5fb365217f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Wed, 22 Jan 2020 11:33:35 +0800 Subject: [PATCH] chore: Fix TS define of FormItem (#21067) --- components/form/FormItem.tsx | 4 ++-- components/form/__tests__/type.test.tsx | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 components/form/__tests__/type.test.tsx diff --git a/components/form/FormItem.tsx b/components/form/FormItem.tsx index 4c1db9aa29..036429e8ad 100644 --- a/components/form/FormItem.tsx +++ b/components/form/FormItem.tsx @@ -40,7 +40,7 @@ export interface FormItemProps fieldKey?: number; } -function FormItem(props: FormItemProps): React.ReactNode { +function FormItem(props: FormItemProps): React.ReactElement { const { name, fieldKey, @@ -98,7 +98,7 @@ function FormItem(props: FormItemProps): React.ReactNode { fieldId?: string, meta?: Meta, isRequired?: boolean, - ) { + ): any { if (noStyle) { return baseChildren; } diff --git a/components/form/__tests__/type.test.tsx b/components/form/__tests__/type.test.tsx new file mode 100644 index 0000000000..3f7146b386 --- /dev/null +++ b/components/form/__tests__/type.test.tsx @@ -0,0 +1,17 @@ +/* eslint-disable no-unused-expressions */ + +import * as React from 'react'; +import Form from '..'; +import Input from '../../input'; + +describe('Form.typescript', () => { + it('Form.Item', () => { +
+ + + +
; + }); +}); + +/* eslint-enable */