Create interface IDisposable

Co-authored-by: Bruno Windels <brunow@matrix.org>
This commit is contained in:
R Midhun Suresh 2021-11-17 19:40:21 +05:30 committed by RMidhunSuresh
parent 08ef84d112
commit a14a8c3a07

View file

@ -15,7 +15,11 @@ limitations under the License.
*/ */
type Func = () => void; type Func = () => void;
type Disposable = { dispose: Func; [key: string]: any } | Func; export interface IDisposable {
dispose(): void;
}
type Disposable = IDisposable | (() => void);
function disposeValue(value: Disposable): void { function disposeValue(value: Disposable): void {
if (typeof value === "function") { if (typeof value === "function") {