-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Table] 扩展PrimaryTableCol类型带来的报错 #5076
Comments
👋 @atox996,感谢给 TDesign 提出了 issue。 |
加上默认的 const columns: PrimaryTableCol<Data & TableRowData>[] = [
{
colKey: "id",
title: "ID",
},
{
colKey: "name",
title: "名称",
cell(h, { row }) {
return row.name || "- -";
}
}
]; |
依然报错~,希望能帮忙提供解决方案 参数“props”和“props” 的类型不兼容。
不能将类型“PrimaryTableCellParams<TableRowData>”分配给类型“PrimaryTableCellParams<{ id: string; name: string; } & TableRowData>”。
属性“row”的类型不兼容。
不能将类型“TableRowData”分配给类型“{ id: string; name: string; } & TableRowData”。
类型“TableRowData”缺少类型“{ id: string; name: string; }”中的以下属性: id, name ts-plugin(2322) |
如果我将类型改为这样,就不会报错了, Data必须是可选类型 const columns: PrimaryTableCol<Partial<Data> & TableRowData>[] = [
{
colKey: "id",
title: "ID",
},
{
colKey: "name",
title: "名称",
cell(h, { row }) {
return row.name || "- -";
}
}
]; |
所以我认为,仓库中的 export interface TableRowData {
[key: string]: any;
children?: TableRowData[];
} 应该改为 export interface TableRowData {
[key: string]?: any;
children?: TableRowData[];
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tdesign-vue-next 版本
1.10.7
重现链接
No response
重现步骤
报错信息:
参数“props”和“props” 的类型不兼容。
不能将类型“PrimaryTableCellParams”分配给类型“PrimaryTableCellParams”。
属性“row”的类型不兼容。
类型“TableRowData”与类型“Data”不具有相同的属性。ts-plugin(2322)
期望结果
No response
实际结果
No response
框架版本
No response
浏览器版本
No response
系统版本
No response
Node版本
No response
补充说明
No response
The text was updated successfully, but these errors were encountered: