Files
explore/toolkit/utils/getComponentDisplayName.ts
2025-01-16 13:46:15 +01:00

12 lines
263 B
TypeScript

import type React from 'react';
export default function getComponentDisplayName(type: string | React.JSXElementConstructor<unknown>) {
if (typeof type === 'string') {
return;
}
if ('displayName' in type) {
return type.displayName as string;
}
}