diff --git a/lib/timers/promises.js b/lib/timers/promises.js index 7c8d364b1dde4f..4d23d15cc116fb 100644 --- a/lib/timers/promises.js +++ b/lib/timers/promises.js @@ -70,10 +70,8 @@ function setTimeout(after, value, options = kEmptyObject) { 'boolean', ref)); } - // TODO(@jasnell): If a decision is made that this cannot be backported - // to 12.x, then this can be converted to use optional chaining to - // simplify the check. - if (signal && signal.aborted) { + + if (signal?.aborted) { return PromiseReject(new AbortError(undefined, { cause: signal.reason })); } let oncancel; @@ -113,10 +111,8 @@ function setImmediate(value, options = kEmptyObject) { 'boolean', ref)); } - // TODO(@jasnell): If a decision is made that this cannot be backported - // to 12.x, then this can be converted to use optional chaining to - // simplify the check. - if (signal && signal.aborted) { + + if (signal?.aborted) { return PromiseReject(new AbortError(undefined, { cause: signal.reason })); } let oncancel;