【发布时间】:2021-08-03 04:48:11
【问题描述】:
我不断收到此错误Type '({ name: string; href: string; icon: IconDefinition; } | { name: string; href: string; icon: IconDefinition; childs: { name: string; href: string; icon: IconDefinition; }[]; })[]' is missing the following properties from type 'navigationItem': name, href, icon, childsts(2739)
但我不明白为什么。
这是我的界面
interface navigationItem {
name: string;
href: string;
icon: IconDefinition;
childs?: dropdown[];
}[]
interface dropdown {
name: string;
href: string;
icon: IconDefinition;
}
还有一些数据
const navItems: navigationItem = [
{ name: "Calendar", href: "/", icon: faBars },
{ name: "Team", href: "/", icon: faBars },
{
name: "Projects",
href: "/",
icon: faBars,
childs: [
{ name: "Accueil", href: "/", icon: faBars },
{ name: "Accueil", href: "/", icon: faBars },
],
},
];
如果有人看到我做错了什么,请随时告诉我:)
【问题讨论】:
标签: reactjs typescript interface next.js