1
- import isObject from 'lodash/isObject' ;
2
- import once from 'lodash/once' ;
3
1
import * as typeIs from './typeIs' ;
4
2
import createUniqueClassName from './createUniqueClassName' ;
5
3
import getNodeTextContent from './getNodeTextContent' ;
@@ -8,6 +6,7 @@ import getTheme from './getTheme';
8
6
import { allEqual } from './allEqual' ;
9
7
export { validateChildren } from './validateChildren' ;
10
8
export { createSyntheticEvent } from './createSyntheticEvent' ;
9
+ export { consoleOnce } from './consoleOnce' ;
11
10
12
11
export {
13
12
type ExtendedComponentProps ,
@@ -87,23 +86,6 @@ export type OneOf<T1, T2> =
87
86
| ( T1 & Partial < Record < Exclude < keyof T2 , keyof T1 > , never > > )
88
87
| ( T2 & Partial < Record < Exclude < keyof T1 , keyof T2 > , never > > ) ;
89
88
90
- /** Helper type to check if element is a specific React Component */
91
- export function isComponentType <
92
- T extends React . ReactElement = React . ReactElement ,
93
- > ( element : React . ReactNode , displayName : string ) : element is T {
94
- return (
95
- element != null &&
96
- typeof element === 'object' &&
97
- 'type' in element &&
98
- ( ( element . type as any ) . displayName === displayName ||
99
- // TODO: temp solution; Components using InferredPolymorphic have a displayName inside render.
100
- // https://jira.mongodb.org/browse/LG-3232
101
- ( isObject ( element . type as any ) &&
102
- 'render' in ( element . type as any ) &&
103
- ( element . type as any ) . render ?. displayName === displayName ) )
104
- ) ;
105
- }
106
-
107
89
/**
108
90
* Utility for making it easier to couple a React Component to a css selector.
109
91
* Useful when writing css selectors that rely on interactivity, i.e. :hover.
@@ -220,9 +202,3 @@ export type RecursivePartial<T> = {
220
202
export function enforceExhaustive ( value : never ) : never {
221
203
throw Error ( `Received unhandled value: ${ value } ` ) ;
222
204
}
223
-
224
- export const consoleOnce = {
225
- error : once ( console . error ) ,
226
- warn : once ( console . warn ) ,
227
- log : once ( console . log ) ,
228
- } ;
0 commit comments