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.
This commit is contained in:
Andrew Clark
2021-07-20 15:39:57 -07:00
committed by GitHub
parent 3f62dec84a
commit 5c6543771b
+1 -1
View File
@@ -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