使用typescript Partial、Omit 对引入的 tsProps进行改造
Omit
通过Omit
对tsProps进行参数扩展
import type { TabsProps } from 'antd';
export interface V2TabsProps extends Omit<TabsProps, 'type' | 'tabBarExtraContent'> {
/**
* @description 款式,可选 ['line', 'card', 'fullCard', 'editable-card']
* @default line
*/
type?: string;
/**
* @description tab bar 上额外的元素
*/
tabBarExtraContent?: ReactNode | { left?: ReactNode, right?: ReactNode, middle?: ReactNode };
}
Partial
通过Partial
更改tsProps的必填项为选填项。
import type { V1FormPickerProps } from '../V1FormPicker';
export interface V1FormTimePickerProps extends Partial<V1FormPickerProps> {
/**
* @description 精度
* @default second
*/
precision?: 'hour' | 'minute' | 'second';
}