interface Props {
className?: string;
visible?: boolean;
show?: boolean;
content?: string;
text?: string;
}
type Res = Omit<Props, 'visible'> | Omit<Props, 'show'>
想要得到结果:
{
className?: string;
show?: boolean;
content?: string;
text?: string;
} | {
className?: string;
visible?: boolean;
content?: string;
text?: string;
}
好像目前没有啥选项能控制显示出计算后的类型,不过可以通过多加个类型来展开: