File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,9 @@ export const Portal = REACT_PORTAL_TYPE;
72
72
export const Profiler = REACT_PROFILER_TYPE ;
73
73
export const StrictMode = REACT_STRICT_MODE_TYPE ;
74
74
export const Suspense = REACT_SUSPENSE_TYPE ;
75
+ export const SuspenseList = __EXPERIMENTAL__
76
+ ? REACT_SUSPENSE_LIST_TYPE
77
+ : undefined ;
75
78
76
79
export { isValidElementType } ;
77
80
@@ -142,3 +145,10 @@ export function isStrictMode(object: any) {
142
145
export function isSuspense ( object : any ) {
143
146
return typeOf ( object ) === REACT_SUSPENSE_TYPE ;
144
147
}
148
+ export function isSuspenseList ( object : any ) {
149
+ if ( __EXPERIMENTAL__ ) {
150
+ return typeOf ( object ) === REACT_SUSPENSE_LIST_TYPE ;
151
+ } else {
152
+ return false ;
153
+ }
154
+ }
Original file line number Diff line number Diff line change @@ -186,6 +186,16 @@ describe('ReactIs', () => {
186
186
expect ( ReactIs . isSuspense ( < div /> ) ) . toBe ( false ) ;
187
187
} ) ;
188
188
189
+ // @gate experimental
190
+ it ( 'should identify suspense list' , ( ) => {
191
+ expect ( ReactIs . isValidElementType ( React . SuspenseList ) ) . toBe ( true ) ;
192
+ expect ( ReactIs . typeOf ( < React . SuspenseList /> ) ) . toBe ( ReactIs . SuspenseList ) ;
193
+ expect ( ReactIs . isSuspenseList ( < React . SuspenseList /> ) ) . toBe ( true ) ;
194
+ expect ( ReactIs . isSuspenseList ( { type : ReactIs . SuspenseList } ) ) . toBe ( false ) ;
195
+ expect ( ReactIs . isSuspenseList ( 'React.SuspenseList' ) ) . toBe ( false ) ;
196
+ expect ( ReactIs . isSuspenseList ( < div /> ) ) . toBe ( false ) ;
197
+ } ) ;
198
+
189
199
it ( 'should identify profile root' , ( ) => {
190
200
expect ( ReactIs . isValidElementType ( React . Profiler ) ) . toBe ( true ) ;
191
201
expect (
You can’t perform that action at this time.
0 commit comments