File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1
- import { ElementType } from 'react' ;
2
- import { ReactTestInstance } from 'react-test-renderer' ;
1
+ import type { ElementType } from 'react' ;
2
+ import type { ReactTestInstance } from 'react-test-renderer' ;
3
3
import prettyFormat , { plugins } from 'pretty-format' ;
4
4
import { defaultMapProps } from './format-default' ;
5
5
@@ -54,15 +54,15 @@ export function formatElementType(type: ElementType): string {
54
54
// }
55
55
56
56
if ( typeof type === 'object' && 'type' in type ) {
57
- // @ts -expect-error
57
+ // @ts -expect-error: despite typing this can happen for class components, e.g. HOCs
58
58
const nestedType = formatElementType ( type . type ) ;
59
59
if ( nestedType ) {
60
60
return nestedType ;
61
61
}
62
62
}
63
63
64
64
if ( typeof type === 'object' && 'render' in type ) {
65
- // @ts -expect-error
65
+ // @ts -expect-error: despite typing this can happen for class components, e.g. HOCs
66
66
const nestedType = formatElementType ( type . render ) ;
67
67
if ( nestedType ) {
68
68
return nestedType ;
You can’t perform that action at this time.
0 commit comments