File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -13,16 +13,17 @@ import type { TreeNode } from './../tree';
13
13
const supportFragment = Boolean ( Fragment ) ;
14
14
15
15
const getReactElementDisplayName = ( { type } : ReactElement < * > ) : string => {
16
- if ( type . displayName ) {
17
- return type . displayName ;
16
+ switch ( true ) {
17
+ case Boolean ( type . displayName ) :
18
+ return type . displayName ;
19
+ case typeof type === 'function' :
20
+ if ( ! type . name || type . name === '_default' ) {
21
+ return 'No Display Name' ;
22
+ }
23
+ return type . name ;
24
+ default :
25
+ return type ;
18
26
}
19
- if ( type . name && type . name !== '_default' ) {
20
- return type . name ;
21
- }
22
- if ( typeof type === 'function' ) {
23
- return 'No Display Name' ;
24
- }
25
- return type ;
26
27
} ;
27
28
28
29
const noChildren = ( propsValue , propName ) => propName !== 'children' ;
You can’t perform that action at this time.
0 commit comments