Fix global reference to Promise (#21926)
Referencing Promise without a type check will throw in environments where Promise is not defined. We will follow up with a lint rule that restricts access to all globals except in dedicated module indirections.
Andrew Clark committed
Jul 20, 2021 at 18:39 UTC
5c6543771b7fe7ca37ab4b4419a7f873e0849cfb
1 file changed
+1
-1
packages/react-dom/src/client/ReactDOMHostConfig.js
+1
-1
@@ -392,7 +392,7 @@ export const scheduleTimeout: any =
392
export const cancelTimeout: any =
393
typeof clearTimeout === 'function' ? clearTimeout : (undefined: any);
394
export const noTimeout = -1;
395
-const localPromise = Promise;
395
+const localPromise = typeof Promise === 'function' ? Promise : undefined;
396
397
// -------------------
398
// Microtasks