From 5c6543771b7fe7ca37ab4b4419a7f873e0849cfb Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Tue, 20 Jul 2021 18:39:57 -0400 Subject: [PATCH] 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. --- packages/react-dom/src/client/ReactDOMHostConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-dom/src/client/ReactDOMHostConfig.js b/packages/react-dom/src/client/ReactDOMHostConfig.js index 43f5077932..74877c1591 100644 --- a/packages/react-dom/src/client/ReactDOMHostConfig.js +++ b/packages/react-dom/src/client/ReactDOMHostConfig.js @@ -392,7 +392,7 @@ export const scheduleTimeout: any = export const cancelTimeout: any = typeof clearTimeout === 'function' ? clearTimeout : (undefined: any); export const noTimeout = -1; -const localPromise = Promise; +const localPromise = typeof Promise === 'function' ? Promise : undefined; // ------------------- // Microtasks