Unverified Commit 6cc7273f authored by Janka Uryga's avatar Janka Uryga Committed by GitHub

fix: setImmediate[util.promisify.custom] access fails in edge runtime (#88685)

Follow up to #88346. Looks like the change there crashes in edge because
`globalThis.setImmediate` isn't defined, so we check before accessing.
parent 2bf8a244
...@@ -23,8 +23,12 @@ const originalSetImmediate = globalThis.setImmediate ...@@ -23,8 +23,12 @@ const originalSetImmediate = globalThis.setImmediate
const originalClearImmediate = globalThis.clearImmediate const originalClearImmediate = globalThis.clearImmediate
const originalNextTick = process.nextTick const originalNextTick = process.nextTick
const originalSetImmediatePromisify: (typeof setImmediate)['__promisify__'] = const originalSetImmediatePromisify: (typeof setImmediate)['__promisify__'] =
// @ts-expect-error: the types for `promisify.custom` are strange typeof originalSetImmediate === 'function'
originalSetImmediate[promisify.custom] ? // @ts-expect-error: the types for `promisify.custom` are strange
originalSetImmediate[promisify.custom]
: // if setImmediate is not defined, we must be in the edge runtime,
// and won't ever enable the patch, so this can be a dummy value
undefined!
export { originalSetImmediate as unpatchedSetImmediate } export { originalSetImmediate as unpatchedSetImmediate }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment