TS2345: Argument of type 'ReactNode' is not assignable to parameter of type 'ReactElement'

You've declared the type of child wrong here:

React.Children.map(children, (child: React.ReactElement, index) => {

children is of type React.ReactNode. React.Element is something entirely different.

You don't need to type this argument at all, React.Children.map already can infer the correct type here. Just this works just fine:

React.Children.map(children, (child, index) => {

Playground