diff --git a/components/_util/type.ts b/components/_util/type.ts new file mode 100644 index 0000000000..2001f229d8 --- /dev/null +++ b/components/_util/type.ts @@ -0,0 +1,3 @@ +export type Diff = ({ [P in T]: P } & + { [P in U]: never } & { [x: string]: never })[T]; +export type Omit = Pick>; diff --git a/components/card/index.tsx b/components/card/index.tsx index cf8a39bede..17250675fb 100644 --- a/components/card/index.tsx +++ b/components/card/index.tsx @@ -7,6 +7,7 @@ import Meta from './Meta'; import Tabs from '../tabs'; import { throttleByAnimationFrameDecorator } from '../_util/throttleByAnimationFrame'; import warning from '../_util/warning'; +import { Omit } from '../_util/type'; export { CardGridProps } from './Grid'; export { CardMetaProps } from './Meta'; @@ -18,7 +19,7 @@ export interface CardTabListType { tab: React.ReactNode; } -export interface CardProps { +export interface CardProps extends Omit, 'title'> { prefixCls?: string; title?: React.ReactNode; extra?: React.ReactNode; diff --git a/components/form/Form.tsx b/components/form/Form.tsx index 6cd2867a5d..79a68133ec 100755 --- a/components/form/Form.tsx +++ b/components/form/Form.tsx @@ -8,6 +8,7 @@ import omit from 'omit.js'; import warning from '../_util/warning'; import FormItem from './FormItem'; import { FIELD_META_PROP, FIELD_DATA_PROP } from './constants'; +import { Omit } from '../_util/type'; export interface FormCreateOption { onFieldsChange?: (props: T, fields: Array) => void; @@ -113,10 +114,6 @@ export interface FormComponentProps { form: WrappedFormUtils; } -export type Diff = - ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]; -export type Omit = Pick>; - export interface ComponentDecorator {

( component: React.ComponentClass

| React.SFC

,