79509673

Date: 2025-03-14 16:29:41
Score: 0.5
Natty:
Report link

As of Explicit Resource Management introduced in TypeScript 5.2, with the power of DisposableStack and AsyncDisposableStack. You can use defer like this.

function example() {
  using cleanup = new DisposableStack();
  cleanup.defer(() => console.log('defer'));
  console.log('do some work');
}
example();
Reasons:
  • Whitelisted phrase (-1.5): You can use
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Yang Gao