Улучшена типизация компонента Table

This commit is contained in:
goodmice 2022-10-06 20:27:48 +05:00
parent 89835f7f00
commit 41515fdb7e
No known key found for this signature in database
GPG Key ID: 63EA771203189CF1

View File

@ -13,7 +13,7 @@ import '@styles/index.css'
export type BaseTableColumn<T> = ColumnGroupType<T> | ColumnType<T>
export type TableColumns<T> = OmitExtends<BaseTableColumn<T>, TableColumnSettings>[]
export type TableContainer<T> = TableProps<T> & {
export type TableContainer<T> = Omit<TableProps<T>, 'columns'> & {
columns: TableColumns<T>
tableName?: string
showSettingsChanger?: boolean
@ -45,9 +45,9 @@ const _Table = <T extends object>({ columns, dataSource, tableName, showSettings
}), [settings, columns, onSettingsChanged, showSettingsChanger, tableName])
return (
<RawTable
<RawTable<T>
columns={newColumns}
dataSource={tryAddKeys(dataSource)}
dataSource={tryAddKeys<T>(dataSource as any)}
{...other}
/>
)