Interface T

42 阅读1分钟

typescript 中箭头函数的 6 种方法 参考 -- blog.csdn.net/weixin_4538…

可以灵活兼容不同的 Type 类型。

interface IPropType<T> {
  callback?: (service: string) => void;
  excludes?: string[];
  XXX: {[key: string]: any} | T[] | null; 
  key: string; // 用于自定义
}

const XXXX = <T,>(props: IPropType<T>) => { }

继承多 type 泛类型

interface IProps<T extends {}, U extends {}, V> extends ProTableProps<T, U> {
  columns: ProColumns<T>[],
  dataSource: T[]
}

将剩余参数提取传入 表格组件 {...tableProps}

  const {columns, dataSource, ...tableProps} = props;