Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjastrzebski committed Jan 8, 2025
1 parent 68ab299 commit ec51869
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/helpers/format-element.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ElementType } from 'react';
import { ReactTestInstance } from 'react-test-renderer';
import type { ElementType } from 'react';
import type { ReactTestInstance } from 'react-test-renderer';
import prettyFormat, { plugins } from 'pretty-format';
import { defaultMapProps } from './format-default';

Expand Down Expand Up @@ -54,15 +54,15 @@ export function formatElementType(type: ElementType): string {
// }

if (typeof type === 'object' && 'type' in type) {
// @ts-expect-error
// @ts-expect-error: despite typing this can happen for class components, e.g. HOCs
const nestedType = formatElementType(type.type);
if (nestedType) {
return nestedType;
}
}

if (typeof type === 'object' && 'render' in type) {
// @ts-expect-error
// @ts-expect-error: despite typing this can happen for class components, e.g. HOCs
const nestedType = formatElementType(type.render);
if (nestedType) {
return nestedType;
Expand Down

0 comments on commit ec51869

Please sign in to comment.