Skip to content

Commit

Permalink
Fix global reference to Promise (#21926)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
acdlite authored Jul 20, 2021
1 parent 3f62dec commit 5c65437
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-dom/src/client/ReactDOMHostConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5c65437

Please sign in to comment.