Skip to content

docs: enforce Promise.withResolvers() more explicitly. - #13600

Merged
WebReflection merged 1 commit into
mainfrom
promise-with-resolvers
Aug 31, 2026
Merged

docs: enforce Promise.withResolvers() more explicitly.#13600
WebReflection merged 1 commit into
mainfrom
promise-with-resolvers

Conversation

@WebReflection

Copy link
Copy Markdown
Contributor

Issue

We keep seeing patterns like this:

const ended: { resolve?: () => void; reject?: (error: Error) => void } = {}
const exit = new Promise<void>((resolve, reject) => {
  ended.resolve = resolve
  ended.reject = reject
})

as opposite of having just this:

const ended = Promise.withResolvers()

which is more explicit and available since 2024 in all runtimes: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers#browser_compatibility

Fixes #

Context

This MR makes the wording around preferring Promise.withResolvers() more explicit, hoping that will lead to less LOC shipped for no reason with also flaky guards around (see both resolve? and reject? instantly attached after so that these are a certainity, not a maybe).

Implementation

The wording has been changed to explicitly avoid the mentioned case, hoping we won't see that pattern with runtime created no-ops around.

@kilo-code-bot

kilo-code-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • AGENTS.md

Reviewed by grok-4.6 · Input: 34.4K · Output: 3.6K · Cached: 165.1K

Review guidance: REVIEW.md from base branch main

@WebReflection
WebReflection merged commit 3b6e055 into main Aug 31, 2026
31 checks passed
@WebReflection
WebReflection deleted the promise-with-resolvers branch August 31, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants