Skip to content

Commit fae9681

Browse files
committed
🐛 fix ts errors
1 parent a387ef4 commit fae9681

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/TableCell.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface TableCellProps<ValueType> {
1818
indent?: number;
1919
indentSize?: number;
2020
column?: ColumnType;
21+
title?: string;
2122
expandIcon?: React.ReactNode;
2223
component?: CustomizeComponent;
2324
}
@@ -56,7 +57,7 @@ export default class TableCell<ValueType> extends React.Component<TableCellProps
5657
} else {
5758
text = get(record, dataIndex);
5859
}
59-
let tdProps: Cell = {};
60+
let tdProps: Cell & { title?: string } = {};
6061
let colSpan: number;
6162
let rowSpan: number;
6263

@@ -108,13 +109,11 @@ export default class TableCell<ValueType> extends React.Component<TableCellProps
108109
if (column.ellipsis) {
109110
if (typeof text === 'string') {
110111
tdProps.title = text;
111-
} else if (
112-
text &&
113-
text.props &&
114-
text.props.children &&
115-
typeof text.props.children === 'string'
116-
) {
117-
tdProps.title = text.children;
112+
} else if (text) {
113+
const { props: textProps } = text as React.ReactElement<any>;
114+
if (textProps && textProps.children && typeof textProps.children === 'string') {
115+
tdProps.title = textProps.children;
116+
}
118117
}
119118
}
120119

0 commit comments

Comments
 (0)