Disposable Not Disposed (ARCH3080)
Esta página aún no está disponible en tu idioma.
Key typescript.performance.disposable-not-disposed · Severity error · Category performance
Creating a resource that must be closed and never releasing it leaks the resource; the object should be scoped-cleaned with using or try/finally.
Incorrect
Section titled “Incorrect”function process(path: string): void { const handle = openResource(path); handle.write("data"); // handle is never closed}Correct
Section titled “Correct”function process(path: string): void { using handle = openResource(path); handle.write("data");} // auto-disposed at end of scopeBind resource-owning objects with using or try/finally so they are released at end of scope.