Answer the question
In order to leave comments, you need to log in
How to set the type recursively?
[{
id: 1,
name: "products",
children: [
{ id: 3, name: "all products" },
{ id: 4, name: "new product"},
],
}]
interface props{
list: {id: number; name: string; children?: any}[]; // Что написать вместо any?
}
Answer the question
In order to leave comments, you need to log in
interface Props {
list: {
id: number;
name: string;
children?: Props['list'];
}[];
}
interface PropsListItem {
id: number;
name: string;
children?: PropsListItem[];
}
interface Props {
list: PropsListItem[];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question