10
10
'use strict' ;
11
11
12
12
import {
13
- REACT_ASYNC_MODE_TYPE ,
14
- REACT_CONCURRENT_MODE_TYPE ,
15
13
REACT_CONTEXT_TYPE ,
16
14
REACT_ELEMENT_TYPE ,
17
15
REACT_FORWARD_REF_TYPE ,
@@ -34,8 +32,6 @@ export function typeOf(object: any) {
34
32
const type = object . type ;
35
33
36
34
switch ( type ) {
37
- case REACT_ASYNC_MODE_TYPE :
38
- case REACT_CONCURRENT_MODE_TYPE :
39
35
case REACT_FRAGMENT_TYPE :
40
36
case REACT_PROFILER_TYPE :
41
37
case REACT_STRICT_MODE_TYPE :
@@ -63,9 +59,6 @@ export function typeOf(object: any) {
63
59
return undefined ;
64
60
}
65
61
66
- // AsyncMode is deprecated along with isAsyncMode
67
- export const AsyncMode = REACT_ASYNC_MODE_TYPE ;
68
- export const ConcurrentMode = REACT_CONCURRENT_MODE_TYPE ;
69
62
export const ContextConsumer = REACT_CONTEXT_TYPE ;
70
63
export const ContextProvider = REACT_PROVIDER_TYPE ;
71
64
export const Element = REACT_ELEMENT_TYPE ;
@@ -81,6 +74,7 @@ export const Suspense = REACT_SUSPENSE_TYPE;
81
74
export { isValidElementType } ;
82
75
83
76
let hasWarnedAboutDeprecatedIsAsyncMode = false ;
77
+ let hasWarnedAboutDeprecatedIsConcurrentMode = false ;
84
78
85
79
// AsyncMode should be deprecated
86
80
export function isAsyncMode ( object : any ) {
@@ -90,15 +84,24 @@ export function isAsyncMode(object: any) {
90
84
// Using console['warn'] to evade Babel and ESLint
91
85
console [ 'warn' ] (
92
86
'The ReactIs.isAsyncMode() alias has been deprecated, ' +
93
- 'and will be removed in React 17+. Update your code to use ' +
94
- 'ReactIs.isConcurrentMode() instead. It has the exact same API.' ,
87
+ 'and will be removed in React 17+.' ,
95
88
) ;
96
89
}
97
90
}
98
- return isConcurrentMode ( object ) || typeOf ( object ) === REACT_ASYNC_MODE_TYPE ;
91
+ return false ;
99
92
}
100
93
export function isConcurrentMode ( object : any ) {
101
- return typeOf ( object ) === REACT_CONCURRENT_MODE_TYPE ;
94
+ if ( __DEV__ ) {
95
+ if ( ! hasWarnedAboutDeprecatedIsConcurrentMode ) {
96
+ hasWarnedAboutDeprecatedIsConcurrentMode = true ;
97
+ // Using console['warn'] to evade Babel and ESLint
98
+ console [ 'warn' ] (
99
+ 'The ReactIs.isConcurrentMode() alias has been deprecated, ' +
100
+ 'and will be removed in React 17+.' ,
101
+ ) ;
102
+ }
103
+ }
104
+ return false ;
102
105
}
103
106
export function isContextConsumer ( object : any ) {
104
107
return typeOf ( object ) === REACT_CONTEXT_TYPE ;
0 commit comments