如何导入此Ant Design TypeScript接口?

问题描述

我遇到此TypeScript错误

类型'xyz'不可分配给类型'TableComponents'。

所以我需要将我的类型强制转换为TableComponents。但是,当我尝试使用以下接口导入该接口时,该接口不可用

import { TableComponents } from 'antd/lib/table/interface';

接口listed here是库的一部分。

如何将其导入我的React项目?

解决方法

您可能会看到interface.tsx的过时版本。

This是主版本,没有TableComponents

antd分支应适合您使用的lib版本。