Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
| 'react.forward_ref' /* 0xead0 | Symbol(react.forward_ref) */
| 'react.suspense' /* 0xead1 | Symbol(react.suspense) */
| 'react.memo' /* 0xead3 | Symbol(react.memo) */
| 'react.lazy' /* 0xead4 | Symbol(react.lazy) */
export const REACT_ELEMENT_TYPE: 'react.element' = is.Element
export const REACT_PORTAL_TYPE: 'react.portal' = is.Portal
export const REACT_FRAGMENT_TYPE: 'react.fragment' = is.Fragment
export const REACT_STRICT_MODE_TYPE: 'react.strict_mode' = is.StrictMode
export const REACT_PROFILER_TYPE: 'react.profiler' = is.Profiler
export const REACT_PROVIDER_TYPE: 'react.provider' = is.ContextProvider
export const REACT_CONTEXT_TYPE: 'react.context' = is.ContextConsumer
export const REACT_CONCURRENT_MODE_TYPE: 'react.concurrent_mode' =
is.ConcurrentMode
export const REACT_FORWARD_REF_TYPE: 'react.forward_ref' = is.ForwardRef
export const REACT_SUSPENSE_TYPE: 'react.suspense' = is.Suspense
export const REACT_MEMO_TYPE: 'react.memo' = is.Memo
export const REACT_LAZY_TYPE: 'react.lazy' = is.Lazy
$$typeof: is.Element,
type: is.Profiler
})
).toBe(REACT_PROFILER_TYPE)
expect(
typeOf({
$$typeof: is.Element,
type: is.StrictMode
})
).toBe(REACT_STRICT_MODE_TYPE)
expect(
typeOf({
$$typeof: is.Element,
type: is.Suspense
})
).toBe(REACT_SUSPENSE_TYPE)
})
})
if (ReactIs.isProfiler(type) || typeOf === ReactIs.Profiler) {
return `Profiler(${type.props!.id})`;
}
if (ReactIs.isPortal(type) || typeOf === ReactIs.Portal) {
const portal = type as PortalLike;
return `Portal(${portal.containerInfo.id || portal.containerInfo.tagName.toLowerCase()})`;
}
if (ReactIs.isStrictMode(type) || typeOf === ReactIs.StrictMode) {
return 'StrictMode';
}
if (ReactIs.isSuspense(type) || typeOf === ReactIs.Suspense) {
return 'Suspense';
}
if (ReactIs.isElement(type)) {
return getTypeName(type.type);
}
return String(type);
}