type subProp = {
id: string,
name: string
};
type ParentProps = {
subscriptions?: [
{
id: string,
items: [???Array Of subProp???]
}
]
}这种情况在只有类型别名的typescript中是可行的吗?如果是,该怎么做呢?我在网上找不到任何可行的选择。如果不是,还有什么选择呢?
发布于 2020-06-30 22:39:31
您可以将items声明为subProps的array,将subscriptions声明为具有id和items类型的数组
type subProp = {
id: string,
name: string
};
type ParentProps = {
subscriptions?: {
id: string,
items: subProp[];
}[];
}https://stackoverflow.com/questions/62659949
复制相似问题