同学你好 你用 memo 包裹它以后,类型变成了 NamedExoticComponent 类型,里面没有 children 属性
interface ExoticComponent<P = {}> {
/**
* **NOTE**: Exotic components are not callable.
*/
(props: P): (ReactElement|null);
readonly $$typeof: symbol;
}
interface NamedExoticComponent<P = {}> extends ExoticComponent<P> {
displayName?: string;
}
可以这样改一下
interface IMenuItemProps {
index: number,
children?: React.ReactNode
}