diff --git a/packages/amis/src/renderers/Form/InputTable.tsx b/packages/amis/src/renderers/Form/InputTable.tsx index 7671aea6e464..6987a8895782 100644 --- a/packages/amis/src/renderers/Form/InputTable.tsx +++ b/packages/amis/src/renderers/Form/InputTable.tsx @@ -305,7 +305,9 @@ export type FormTableRendererEvent = export type FormTableRendererAction = 'add' | 'delete' | 'reset' | 'clear'; -export default class FormTable extends React.Component { +export default class FormTable< + T extends TableProps = TableProps +> extends React.Component { static defaultProps = { placeholder: 'placeholder.empty', scaffold: {}, @@ -358,7 +360,7 @@ export default class FormTable extends React.Component { leading: false }); - constructor(props: TableProps) { + constructor(props: T) { super(props); const {addHook} = props; const items = Array.isArray(props.value) ? props.value.concat() : []; diff --git a/packages/amis/src/renderers/Table/ColumnToggler.tsx b/packages/amis/src/renderers/Table/ColumnToggler.tsx index d63776f6af14..a036657fcc58 100644 --- a/packages/amis/src/renderers/Table/ColumnToggler.tsx +++ b/packages/amis/src/renderers/Table/ColumnToggler.tsx @@ -132,10 +132,9 @@ export interface ColumnTogglerState { tempColumns: any[]; } -export default class ColumnToggler extends React.Component< - ColumnTogglerProps, - ColumnTogglerState -> { +export default class ColumnToggler< + T extends ColumnTogglerProps = ColumnTogglerProps +> extends React.Component { state: ColumnTogglerState = { isOpened: false, enableSorting: false, @@ -156,7 +155,7 @@ export default class ColumnToggler extends React.Component< sortable?: Sortable; dragRefDOM: HTMLElement; - constructor(props: ColumnTogglerProps) { + constructor(props: T) { super(props); this.open = this.open.bind(this);