如何在Typescript tsx中遍历React组件的子项?
以下是有效的jsx:
public render() { return ( <div> {React.Children.map(this.props.children,x => x.props.foo)} </div> ); }
但是,在Typescript中,x的类型是React.ReactElement< any>所以我无法获得道具.我需要做某种铸造吗?