refactor: delete deprecated React.ReactChild (#37551)

use React.ReactElement | string | number to replace the deprecated React.ReactChild
This commit is contained in:
bowen-wu 2022-09-16 09:59:38 +08:00 committed by GitHub
parent c161ab6e40
commit 3619caf1b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,7 +29,7 @@ function isReactFragment(node: React.ReactNode) {
}
// Insert one space between two chinese characters automatically.
function insertSpace(child: React.ReactChild, needInserted: boolean) {
function insertSpace(child: React.ReactElement | string | number, needInserted: boolean) {
// Check the child if is undefined or null.
if (child === null || child === undefined) {
return;
@ -74,7 +74,7 @@ function spaceChildren(children: React.ReactNode, needInserted: boolean) {
// Pass to React.Children.map to auto fill key
return React.Children.map(childList, child =>
insertSpace(child as React.ReactChild, needInserted),
insertSpace(child as React.ReactElement | string | number, needInserted),
);
}