Skip to content

Commit

Permalink
Fix global reference to Promise (facebook#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 and zhengjitf committed Apr 15, 2022
1 parent a2e9595 commit e2e4897
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 e2e4897

Please sign in to comment.