In version 2.22.19 of react-table, which seems to be the latest at the time of writing, the sample found at this link is generating errors when building: https://www.patternfly.org/v4/documentation/react/components/table/#table-with-width-modifiers
The error is:
error TS2322: Type '(() => { className: string; })[]' is not assignable to type '((label?: (string & { title?: ReactNode; props?: any; }) | (object & { title?: ReactNode; props?: any; }) | (ComponentClass<any, any> & { title?: ReactNode; props?: any; }) | (FunctionComponent<any> & { ...; }) | undefined, rowData?: IRowData | undefined, columnIndex?: number | undefined, column?: IColumn | undefine...'.
168 transforms: [cellWidth(70)],
~~~~~~~~~~
Indeed, apparently, the transforms attribute of ICell is typed as ITransforms as seen in this code:
|
export interface ICell { |
|
title?: string | React.ReactNode; |
|
transforms?: ITransforms; |
|
cellTransforms?: ITransforms; |
|
columnTransforms?: ITransforms; |
|
formatters?: IFormatters; |
|
cellFormatters?: IFormatters; |
|
props?: any; |
|
data?: any; |
|
header?: any; |
|
cell?: any; |
|
dataLabel?: string; |
|
} |
But the cellWidth transform does not comply with that interface, so, typescript transpiler fails with error.
I think types/interfaces should be fixed.
Reactions are currently unavailable
In version 2.22.19 of react-table, which seems to be the latest at the time of writing, the sample found at this link is generating errors when building: https://www.patternfly.org/v4/documentation/react/components/table/#table-with-width-modifiers
The error is:
error TS2322: Type '(() => { className: string; })[]' is not assignable to type '((label?: (string & { title?: ReactNode; props?: any; }) | (object & { title?: ReactNode; props?: any; }) | (ComponentClass<any, any> & { title?: ReactNode; props?: any; }) | (FunctionComponent<any> & { ...; }) | undefined, rowData?: IRowData | undefined, columnIndex?: number | undefined, column?: IColumn | undefine...'. 168 transforms: [cellWidth(70)], ~~~~~~~~~~Indeed, apparently, the transforms attribute of ICell is typed as ITransforms as seen in this code:
patternfly-react/packages/patternfly-4/react-table/src/components/Table/Table.tsx
Lines 152 to 164 in 73c6169
But the cellWidth transform does not comply with that interface, so, typescript transpiler fails with error.
I think types/interfaces should be fixed.