Skip to content

Latest commit

 

History

History

polyfill-symbol-dispose

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Polyfill for Symbol.dispose and Symbol.asyncDispose

NPM Version

This is a lightweight polyfill for the wellknown symbols dispose and asyncDispose as defined in the proposal for Explicit Resource Management. Both Babel and TypeScript support the using and await using Syntax but require the symbols to be defined to work. This polyfill will only create the symbols if they don't exist yet and should be imported before one of the symbols is used. Node.js implemented its own polyfill in versions 18.18 and 20.4 until official support lands in v8.

A complete polyfill of the proposal is available through the disposablestack package.