chore: add isValidElement for isFragment (#38056)

This commit is contained in:
lijianan 2022-10-17 16:23:45 +08:00 committed by GitHub
parent 14b83d97b5
commit a2de8f7b2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@ import * as React from 'react';
export const { isValidElement } = React;
export function isFragment(child: React.ReactElement): boolean {
return child && child.type === React.Fragment;
return child && isValidElement(child) && child.type === React.Fragment;
}
type AnyObject = Record<PropertyKey, any>;