I am quite new to Typescript, but I have to debug somebody else's code. It is about a component in components\ViewTable.tsx
which worked previously, before updating TS/JS packages. It contains the following code
\\ Lines 8-9
import { Table } from "antd";
const { Column, ColumnGroup } = Table;
\\ Line 52
class MyTable extends Table<Interfaces.ViewEntry>;
\\ ...
export class ViewTable extends React.Component<ViewTableProps, ViewTableState> {
render() {
return (
<div>
<div className="view-table">
\\ Line 97ff
<MyTable size="small" dataSource={this.props.viewData}
rowKey={(record) => (record.GeneralLedgerId).toString()}
locale={{ emptyText: 'No applicable view data found' }}
pagination={false}>
\\ ...
This used to work, but after an update to the most recent versions of React(-Dom) (both version 16.10.2), Antd (version 3.24.0), Typescript (version 3.6.4), I get errors galore:
Error TS2459 (TS) Type 'ComponentClass, "loading" | "footer" | "style" | "title" | "scroll" | "size" | "children" | "className" | "prefixCls" | "locale" | "getPopupContainer" | "onChange" | "dataSource" | ... 27 more ... | "sortDirections">, any>' has no property 'ColumnGroup' and no string index signature. 9
Error TS2459 (TS) Type 'ComponentClass, "loading" | "footer" | "style" | "title" | "scroll" | "size" | "children" | "className" | "prefixCls" | "locale" | "getPopupContainer" | "onChange" | "dataSource" | ... 27 more ... | "sortDirections">, any>' has no property 'Column' and no string index signature. 9
Error TS1005 (TS) '(' expected. 52
Error TS2348 (TS) Value of type 'ComponentClass, "loading" | "footer" | "style" | "title" | "scroll" | "size" | "children" | "className" | "prefixCls" | "locale" | "getPopupContainer" | "onChange" | "dataSource" | ... 27 more ... | "sortDirections">, any>' is not callable. Did you mean to include 'new'? 52
Error TS2339 (TS) Property 'size' does not exist on type '{}'. 97
Error TS2607 (TS) JSX element class does not support attributes because it does not have a 'props' property. 97
Error TS2605 (TS) JSX element type 'MyTable' is not a constructor function for JSX elements. Property 'render' is missing in type 'MyTable'. 97
Reading documentation and searching on the web with different search terms did not help. May you be so kind and give me a hint what is happening?
Some thoughts
In order to align the react types with those of ant.design, see https://ant.design/docs/react/use-in-typescript but I was not too successful.