X 归档 2023-06-16
Could someone ELI5 the 'using' proposal for me?
https://github.com/tc39/proposal-explicit-resource-management
https://github.com/tc39/proposal-explicit-resource-management
TypeScript 5.2 will introduce a new keyword - 'using', that you can use to dispose anything with a [Symbol.dispose] function when it leaves scope.
TypeScript 5.2 将引入一个新关键字——'using',当对象离开作用域时,你可以用它自动释放任何带 [Symbol.dispose] 函数的东西。


