如何从@types/react-table 包中的`Column` 将 Cell 设为所需类型

问题描述

我不太确定如何表达我的问题,但我使用 @type/react-table 作为表格元素的类型。如何根据需要从 Column type 创建新类型以生成 Cell? 我的想法是创建一个Column 这样的新类型,并根据需要找到 Column 与 Cell 的组合。然后使用 or 逻辑。但它不起作用 所以错误形式我的代码Property 'Cell' does not exist on type 'TypeColumn'. from myDataB.Cell

export interface Context {
    [key: string]: any;
}
type TypeCellColumn = Column<Context> & {Cell: Cell}

const myDataA: TypeColumn | TypeCellColumn = {
  id: 'dataA',};

const myDataB: TypeColumn | TypeCellColumn = {
  userId: 'dataB',Cell({value}){
    return (<a>{value}</a>)
  }
}
console.log(myDataB.Cell)
            ........

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)