Closed mlhaufe closed 2 months ago
TypeScript as of v5.2 added support for the Stage 3 ECMAScript Explicit Resource Management feature:
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management
So instead of having to write:
const conn = new PGliteWorker(this._connString) try { const result = await conn.query(...) // ... return parse(result) } finally { // ... conn.close() }
We can write:
using conn = new PGliteWorker(this._connString) const result = await conn.query(...) // ... return parse(result)
I think it will be a nice usability win if PGliteInterface implements the Disposable interface
PGliteInterface
Disposable
Hey, yep this would be a great use for these new features.
I would happily except a PR implementing it 👍
TypeScript as of v5.2 added support for the Stage 3 ECMAScript Explicit Resource Management feature:
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management
So instead of having to write:
We can write:
I think it will be a nice usability win if
PGliteInterface
implements theDisposable
interface