
Safari shipped it. Chrome has it. Firefox has it. Node.js has had it for two releases. JavaScript’s using keyword — the feature that ties cleanup logic to block scope so you stop writing try/finally boilerplate — is now running in all three major JavaScript engines. That tipped on August 13, when WebKit shipped Explicit Resource Management in Safari Technology Preview 250. If you’ve been holding off on adopting it without a polyfill, the window for server-side code is now. Browser production use follows when Safari stable ships, likely September or October.
What using Actually Does
It is not complicated. Declare a resource with using instead of const, and the engine calls [Symbol.dispose]() on it when the block exits — on a normal return, on a thrown exception, on every exit path. For async cleanup, await using triggers [Symbol.asyncDispose](). You stop tracking cleanup manually. The V8 team’s writeup has the full technical spec if you want to go deep.
Here is the before and after for a database connection:
// Before: try/finally, easy to omit or get wrong
const conn = await pool.acquire();
try {
return await conn.query("SELECT * FROM users WHERE id = $1", [id]);
} finally {
await pool.release(conn); // forget this once and you have a leak
}
// After: using keyword handles it
class PooledConn {
constructor(conn, pool) { this.conn = conn; this.pool = pool; }
async [Symbol.asyncDispose]() { await this.pool.release(this.conn); }
}
async function getUser(id) {
await using conn = new PooledConn(await pool.acquire(), pool);
return conn.conn.query("SELECT * FROM users WHERE id = $1", [id]);
} // release runs here, even if the query throws
Same guarantee applies to file handles:
import { open } from "node:fs/promises";
async function readConfig(path) {
await using fh = await open(path, "r");
return JSON.parse(await fh.readFile({ encoding: "utf-8" }));
} // file closed automatically
The pattern is the same one C# using, Python with, and Java try-with-resources have offered for years. JavaScript is late to the table, but the design is clean — DisposableStack lets you register multiple cleanup steps dynamically, running them in LIFO order even when individual cleanups throw. MDN’s Symbol.dispose reference covers the full API surface.
What to Do This Week
Three concrete actions, depending on where you are:
- Node.js 22+ (server-side): Native support is already there. Open your
tsconfig.json, set"target": "ES2026", remove any explicit-resource-management polyfill shims, and start writingusingdeclarations natively. TypeScript has parsed the syntax since 5.2 — what changes now is the output. - Browser targets today: Keep
targetatES2022or lower. TypeScript will continue downcompilingusingto try/finally. Nothing breaks. Revisit when Safari 20 ships stable. - No TypeScript: Chrome 134+, Firefox 134+, and Node.js 22+ all run
usingnatively. Safari stable is the only missing piece. Check your analytics — if Safari is a small fraction of your traffic, you may be comfortable shipping today.
Why This Actually Matters
Most coverage of the using keyword focuses on the syntax. The more important story is what it means for JavaScript as a platform. Resource leaks are a persistent source of production bugs — leaked connections, unclosed file handles, event listeners that accumulate across navigation. The language had no standard answer. Every framework invented its own: React’s useEffect return, Node streams’ .destroy(), AbortController for fetch. None of it was portable.
using standardizes the cleanup protocol across the entire ecosystem. Once Node.js adds Symbol.asyncDispose to its built-in stream, socket, and file-handle classes — already under discussion — cleanup becomes declarative everywhere. Testing frameworks (Vitest, Jest) are adding first-class support for disposable fixtures. Third-party ORMs and database drivers will follow. The TC39 proposal has the full roadmap for what’s coming next in the ecosystem.
The using keyword landing in all engines is not just a syntax feature. It is the starting point for a cleaner resource management story across the JavaScript platform.
One Honest Caveat
Safari Technology Preview is not stable Safari. STP 250 is a developer build — it runs on Mac only, updates every two weeks, and features in it are not guaranteed to ship unchanged. Apple has not announced a timeline for Explicit Resource Management in stable Safari. Based on historical patterns, Safari 20 alongside iOS 20 and macOS 16 in September or October 2026 is the most likely window. Plan accordingly and do not drop your browser-targeted transpilation just yet.













