Menu

Post image 1
Post image 2
Post image 3
1 / 3
0

Promise.withResolvers: The Pattern That Killed Half Your Deferred Helpers

DEV Community·Gabriel Anhaia·27 days ago
#Sj1P3AsF
Reading 0:00
15s threshold

Book: TypeScript Essentials — From Working Developer to Confident TS, Across Node, Bun, Deno, and the Browser Also by me: The TypeScript Library — the 5-book collection My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools Me: xgabriel.com | GitHub Open any non-trivial TypeScript codebase and search for the string createDeferred . You will probably find one. Maybe two. They are usually about ten lines long, written by the same engineer, copied between repos, and tucked into a file called utils/promise.ts next to a helper for sleep and a helper for withTimeout . They all do the same thing: build a Promise , capture resolve and reject from inside the executor, and hand the trio back to the caller. By the third repo most engineers carry a createDeferred helper around like a houseplant. That helper has been obsolete since 2024.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More